<commit_before>﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using Kudu.Core.Deployment;
using Xunit;

namespace Kudu.Core.Infrastructure.Test
{
    public class MsBuildSiteBuilderFacts
    {
        [Fact]
        public void GetPropertyStringReturnsProperStringWith1Property()
        {
            Dictionary<string, string> properties = new Dictionary<string, string>();
            properties["sanity"] = "sane";

            this.RunGetPropertyStringScenario(properties, @"sanity=""sane""");
        }

        [Fact]
        public void GetPropertyStringReturnsProperStringWith3Properties()
        {
            Dictionary<string, string> properties = new Dictionary<string, string>();
            properties["sanity"] = "sane";
            properties["sanity1"] = "sane1";
            properties["sanity2"] = "sane2";

            this.RunGetPropertyStringScenario(properties, @"sanity=""sane"";sanity1=""sane1"";sanity2=""sane2""");
        }

        [Fact]
        public void GetPropertyStringReturnsProperStringWithNoPreperties()
        {
            Dictionary<string, string> properties = new Dictionary<string, string>();

            this.RunGetPropertyStringScenario(properties, string.Empty);
        }

        private void RunGetPropertyStringScenario(Dictionary<string, string> properties, string expectedResult)
        {
            var buildPropertyProviderTest = new BuildPropertyProviderTest(properties);
            var siteBuilder = new MsBuildSiteBuilderTest(buildPropertyProviderTest);
            var result = siteBuilder.GetPropertyStringForTest();

            Assert.Equal(expectedResult, result);
        }<commit_msg>Updated unit tests in MsBuildSiteBuilderFacts to use PropertyData.<commit_after>﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using Kudu.Core.Deployment;
using Xunit;
using Xunit.Extensions;

namespace Kudu.Core.Infrastructure.Test
{
    public class MsBuildSiteBuilderFacts
    {
        [Theory]
        [PropertyData("GetPropertyStringData")]
        private void RunGetPropertyStringScenario(Dictionary<string, string> properties, string expectedResult)
        {
            var buildPropertyProviderTest = new BuildPropertyProviderTest(properties);
            var siteBuilder = new MsBuildSiteBuilderTest(buildPropertyProviderTest);
            var result = siteBuilder.GetPropertyStringForTest();

            Assert.Equal(expectedResult, result);
        }

        public static IEnumerable<object[]> GetPropertyStringData
        {
            get
            {
                Dictionary<string, string> properties = new Dictionary<string, string>();
                properties["sanity"] = "sane";
                yield return new object[] { properties, @"sanity=""sane""" };

                properties = new Dictionary<string, string>();
                properties["sanity"] = "sane";
                properties["sanity1"] = "sane1";
                properties["sanity2"] = "sane2";
                yield return new object[] { properties, @"sanity=""sane"";sanity1=""sane1"";sanity2=""sane2""" };

                properties = new Dictionary<string, string>();
                yield return new object[] { properties, string.Empty };
            }
        }
{'fraction_non_alphanumeric': 0.10282621767889356, 'fraction_numerical': 0.005411906193625977, 'mean_word_length': 2.810996563573883, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3868267', 'n_tokens_mistral': 842, 'n_tokens_neox': 817, 'n_words': 174}