diff --git a/BREAKING_CHANGES.md b/BREAKING_CHANGES.md index 3d68b99..cce0177 100644 --- a/BREAKING_CHANGES.md +++ b/BREAKING_CHANGES.md @@ -1,6 +1,31 @@ Breaking Changes ================ +Version 3.3 +----------- +The classes inheriting from `FileDictionarySource` have been marked as obsolete and will be removed in version 4. Instead you should use the new `Words` class, passing in the name of a file dictionary (either one of the built-in ones or one that you create). All the built-in ones are listed in the FromDictionary class where the constants match the filename embedded into Dossier. So, for example, instead of using the `GeoCountrySource` class you would instead use `Words(FromDictionary.GeoCountry)`. + +All of the file dictionaries have been added to the AnonymousValueFixture class as equivalence class extension methods. So, for example, in your builder class you can now call: + +```c# +Any.InternetURL(); +Any.LoremIpsum(); +Any.ColourName(); +``` + +Picking functionality has been added which allows you to select items from a list according to different strategies. Currently, two strategies have been added, `RandomItemFrom` and `RepeatingSequenceFrom`: + +```c# +var names = new Words(FromDictionary.PersonNameFirst).Data; +var days = new List {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday"}; +var customers = Builder + .CreateListOfSize(15) + .All() + .Set(x => x.Name, Pick.RandomItemFrom(names).Next) + .Set(x => x.Day, Pick.RepeatingSequenceFrom(days).Next) + .BuildList(); +``` + Version 3.0 ----------- diff --git a/TestStack.Dossier.Tests/DataSources/DataSourceConventionTests.cs b/TestStack.Dossier.Tests/DataSources/DataSourceConventionTests.cs index a5c3167..7fa4538 100644 --- a/TestStack.Dossier.Tests/DataSources/DataSourceConventionTests.cs +++ b/TestStack.Dossier.Tests/DataSources/DataSourceConventionTests.cs @@ -2,9 +2,7 @@ using System.Linq; using Shouldly; using TestStack.Dossier.DataSources; -using TestStack.Dossier.DataSources.Geography; -using TestStack.Dossier.DataSources.Person; -using Xunit; +using TestStack.Dossier.DataSources.Dictionaries; using Xunit.Extensions; namespace TestStack.Dossier.Tests.DataSources @@ -25,21 +23,21 @@ public static IEnumerable TestCases { get { - yield return new object[] { new GeoContinentSource(), 7 }; - yield return new object[] { new GeoCountrySource(), 249 }; - yield return new object[] { new GeoCountryCodeSource(), 64 }; - yield return new object[] { new GeoLatitudeSource(), 1000 }; - yield return new object[] { new GeoLongitudeSource(), 1000 }; + yield return new object[] { new Words(FromDictionary.GeoContinent), 7 }; + yield return new object[] { new Words(FromDictionary.GeoCountry), 249 }; + yield return new object[] { new Words(FromDictionary.GeoCountryCode), 64 }; + yield return new object[] { new Words(FromDictionary.GeoLatitude), 1000 }; + yield return new object[] { new Words(FromDictionary.GeoLongitude), 1000 }; - yield return new object[] { new PersonEmailAddressSource(), 1000 }; - yield return new object[] { new PersonLanguageSource(), 97 }; - yield return new object[] { new PersonNameFirstFemaleSource(), 100 }; - yield return new object[] { new PersonNameFirstSource(), 479 }; - yield return new object[] { new PersonNameFullSource(), 1000 }; - yield return new object[] { new PersonNameLastSource(), 747 }; - yield return new object[] { new PersonNameFirstMaleSource(), 100 }; - yield return new object[] { new PersonNameSuffixSource(), 5 }; - yield return new object[] { new PersonNameTitleSource(), 9 }; + yield return new object[] { new Words(FromDictionary.PersonEmailAddress), 1000 }; + yield return new object[] { new Words(FromDictionary.PersonLanguage), 97 }; + yield return new object[] { new Words(FromDictionary.PersonNameFirstFemale), 100 }; + yield return new object[] { new Words(FromDictionary.PersonNameFirst), 479 }; + yield return new object[] { new Words(FromDictionary.PersonNameFull), 1000 }; + yield return new object[] { new Words(FromDictionary.PersonNameLast), 747 }; + yield return new object[] { new Words(FromDictionary.PersonNameFirstMale), 100 }; + yield return new object[] { new Words(FromDictionary.PersonNameSuffix), 5 }; + yield return new object[] { new Words(FromDictionary.PersonNameTitle), 9 }; } } } diff --git a/TestStack.Dossier.Tests/DataSources/Dictionaries/CacheTests.cs b/TestStack.Dossier.Tests/DataSources/Dictionaries/CacheTests.cs deleted file mode 100644 index 45d34ec..0000000 --- a/TestStack.Dossier.Tests/DataSources/Dictionaries/CacheTests.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using System.Collections.Generic; -using Shouldly; -using TestStack.Dossier.DataSources.Dictionaries; -using Xunit; - -namespace TestStack.Dossier.Tests.DataSources.Dictionaries -{ - public class CacheTests : IDisposable - { - public CacheTests() - { - Cache.Clear(); - } - - [Fact] - public void WhenRequestingAnItemNotInTheCache_ThenReturnsNull() - { - Cache.Get("SomethingThatDoesNotExist").ShouldBe(null); - } - - [Fact] - public void WhenAddingAnItemToTheCache_ThenTheItemIsPersistedInTheCache() - { - var collection = new List{"item1", "item2"}; - Cache.Set("myCollection", collection); - Cache.Get("myCollection").ShouldBeSameAs(collection); - } - - [Fact] - public void WhenAddingAnItemToTheCacheWithTheSameKeyAsAnExistingItem_ThenTheOriginalItemIsReplacedWithTheNewItem() - { - var collection = new List { "item1", "item2" }; - var collection2 = new List { "item3" }; - Cache.Set("myCollection", collection); - - Cache.Set("myCollection", collection2); - - Cache.Get("myCollection").ShouldBeSameAs(collection2); - } - - [Fact] - public void WhenCheckingCacheContainesAnItemThatIsInCache_ThenShouldReturnTrue() - { - var collection = new List {"item1", "item2"}; - Cache.Set("myCollection", collection); - Cache.Contains("myCollection").ShouldBe(true); - } - - [Fact] - public void WhenCheckingCacheContainesAnItemThatIsNotInCache_ThenShouldReturnFalse() - { - Cache.Contains("SomethingThatDoesNotExist").ShouldBe(false); - } - - - public void Dispose() - { - Cache.Clear(); - } - } -} diff --git a/TestStack.Dossier.Tests/DataSources/Dictionaries/FileDictionaryRepositoryIntegrationTests.cs b/TestStack.Dossier.Tests/DataSources/Dictionaries/CachedFileDictionaryRepositoryIntegrationTests.cs similarity index 94% rename from TestStack.Dossier.Tests/DataSources/Dictionaries/FileDictionaryRepositoryIntegrationTests.cs rename to TestStack.Dossier.Tests/DataSources/Dictionaries/CachedFileDictionaryRepositoryIntegrationTests.cs index 50171e7..1665ced 100644 --- a/TestStack.Dossier.Tests/DataSources/Dictionaries/FileDictionaryRepositoryIntegrationTests.cs +++ b/TestStack.Dossier.Tests/DataSources/Dictionaries/CachedFileDictionaryRepositoryIntegrationTests.cs @@ -5,7 +5,7 @@ namespace TestStack.Dossier.Tests.DataSources.Dictionaries { - public class FileDictionaryRepositoryIntegrationTests + public class CachedFileDictionaryRepositoryIntegrationTests { [Fact] public void GivenAnExternalFileDictionaryExists_WhenRetrievingWords_ThenExternalDictionaryIsUsed() diff --git a/TestStack.Dossier.Tests/DataSources/Dictionaries/WordsCacheTests.cs b/TestStack.Dossier.Tests/DataSources/Dictionaries/WordsCacheTests.cs new file mode 100644 index 0000000..f0ca164 --- /dev/null +++ b/TestStack.Dossier.Tests/DataSources/Dictionaries/WordsCacheTests.cs @@ -0,0 +1,45 @@ +using System; +using System.IO; +using Shouldly; +using TestStack.Dossier.DataSources.Dictionaries; +using Xunit; + +namespace TestStack.Dossier.Tests.DataSources.Dictionaries +{ + public class WordsCacheTests : IDisposable + { + private const string DictionaryThatDoesNotExist = "DictionaryThatDoesNotExist"; + + public WordsCacheTests() + { + WordsCache.Clear(); + } + + [Fact] + public void WhenRequestingAnItemInTheCache_ThenReturnsSameItem() + { + var words1 = WordsCache.Get(FromDictionary.InternetUrl); + var words2 = WordsCache.Get(FromDictionary.InternetUrl); + words1.ShouldBeSameAs(words2); + } + + [Fact] + public void WhenRequestingAnItemNotInTheCache_ThenReturnsWordsSourceForItemDictionary() + { + var words = WordsCache.Get(DictionaryThatDoesNotExist); + words.DictionaryName.ShouldBe(DictionaryThatDoesNotExist); + } + + [Fact] + public void WhenUsingCachedWordsForNonExistentDictionary_ThenWordsSourceThrowsFileNotFoundException() + { + var words = WordsCache.Get(DictionaryThatDoesNotExist); + Should.Throw(() => words.Next()); + } + + public void Dispose() + { + WordsCache.Clear(); + } + } +} diff --git a/TestStack.Dossier.Tests/DataSources/Dictionaries/FileDictionarySourceTests.cs b/TestStack.Dossier.Tests/DataSources/Dictionaries/WordsTests.cs similarity index 79% rename from TestStack.Dossier.Tests/DataSources/Dictionaries/FileDictionarySourceTests.cs rename to TestStack.Dossier.Tests/DataSources/Dictionaries/WordsTests.cs index 0394497..1053125 100644 --- a/TestStack.Dossier.Tests/DataSources/Dictionaries/FileDictionarySourceTests.cs +++ b/TestStack.Dossier.Tests/DataSources/Dictionaries/WordsTests.cs @@ -5,7 +5,7 @@ namespace TestStack.Dossier.Tests.DataSources.Dictionaries { - public class FileDictionarySourceTests + public class WordsTests { [Fact] public void WhenInitializingList_ThenPassClassNameToRepositoryAsDictionaryName() @@ -19,9 +19,9 @@ public void WhenInitializingList_ThenPassClassNameToRepositoryAsDictionaryName() } } - public class DummySource : FileDictionarySource + public class DummySource : Words { internal DummySource(IDictionaryRepository repository) - : base(Substitute.For(), repository) { } + : base(Substitute.For(), repository, "Dummy") { } } } diff --git a/TestStack.Dossier.Tests/EquivalenceClasses/AddressAusEquivalenceTests.cs b/TestStack.Dossier.Tests/EquivalenceClasses/AddressAusEquivalenceTests.cs new file mode 100644 index 0000000..30843a6 --- /dev/null +++ b/TestStack.Dossier.Tests/EquivalenceClasses/AddressAusEquivalenceTests.cs @@ -0,0 +1,46 @@ +using System.Collections.Generic; +using TestStack.Dossier.DataSources; +using TestStack.Dossier.DataSources.Dictionaries; +using Xunit.Extensions; + +namespace TestStack.Dossier.Tests.EquivalenceClasses +{ + public class AddressAusEquivalenceTests : FileDictionaryEquivalenceTests + { + [Theory] + [ClassData(typeof(AddressAusTestCases))] + public override void WhenGettingAnyData_ThenReturnRandomDataWhichIsReasonablyUnique(DataSource source, List testCases) + { + base.WhenGettingAnyData_ThenReturnRandomDataWhichIsReasonablyUnique(source, testCases); + } + } + + public class AddressAusTestCases : FileDictionaryEquivalenceTestCases + { + protected override List GetData() + { + return new List + { + new object[] + {new Words(FromDictionary.AddressAusCity), GenerateTestCasesForSut(Any.AddressAusCity)}, + new object[] + {new Words(FromDictionary.AddressAusCompany), GenerateTestCasesForSut(Any.AddressAusCompany)}, + new object[] + {new Words(FromDictionary.AddressAusPhone), GenerateTestCasesForSut(Any.AddressAusPhone)}, + new object[] + {new Words(FromDictionary.AddressAusPostCode), GenerateTestCasesForSut(Any.AddressAusPostCode)}, + new object[] + {new Words(FromDictionary.AddressAusState), GenerateTestCasesForSut(Any.AddressAusState)}, + new object[] + { + new Words(FromDictionary.AddressAusStateAbbreviation), + GenerateTestCasesForSut(Any.AddressAusStateAbbreviation) + }, + new object[] + {new Words(FromDictionary.AddressAusStreet), GenerateTestCasesForSut(Any.AddressAusStreet)}, + new object[] + {new Words(FromDictionary.AddressAusWebsite), GenerateTestCasesForSut(Any.AddressAusWebsite)}, + }; + } + } +} diff --git a/TestStack.Dossier.Tests/EquivalenceClasses/AddressUkEquivalenceTests.cs b/TestStack.Dossier.Tests/EquivalenceClasses/AddressUkEquivalenceTests.cs new file mode 100644 index 0000000..36d1ce2 --- /dev/null +++ b/TestStack.Dossier.Tests/EquivalenceClasses/AddressUkEquivalenceTests.cs @@ -0,0 +1,41 @@ +using System.Collections.Generic; +using TestStack.Dossier.DataSources; +using TestStack.Dossier.DataSources.Dictionaries; +using Xunit.Extensions; + +namespace TestStack.Dossier.Tests.EquivalenceClasses +{ + public class AddressUkEquivalenceClasses : FileDictionaryEquivalenceTests + { + [Theory] + [ClassData(typeof(AddressUkTestCases))] + public override void WhenGettingAnyData_ThenReturnRandomDataWhichIsReasonablyUnique(DataSource source, List testCases) + { + base.WhenGettingAnyData_ThenReturnRandomDataWhichIsReasonablyUnique(source, testCases); + } + } + + public class AddressUkTestCases : FileDictionaryEquivalenceTestCases + { + protected override List GetData() + { + return new List + { + new object[] + {new Words(FromDictionary.AddressUkCounty), GenerateTestCasesForSut(Any.AddressUkCounty)}, + new object[] + {new Words(FromDictionary.AddressUkCity), GenerateTestCasesForSut(Any.AddressUkCity)}, + new object[] + {new Words(FromDictionary.AddressUkCompany), GenerateTestCasesForSut(Any.AddressUkCompany)}, + new object[] + {new Words(FromDictionary.AddressUkPhone), GenerateTestCasesForSut(Any.AddressUkPhone)}, + new object[] + {new Words(FromDictionary.AddressUkPostCode), GenerateTestCasesForSut(Any.AddressUkPostCode)}, + new object[] + {new Words(FromDictionary.AddressUkStreet), GenerateTestCasesForSut(Any.AddressUkStreet)}, + new object[] + {new Words(FromDictionary.AddressUkWebsite), GenerateTestCasesForSut(Any.AddressUkWebsite)}, + }; + } + } +} diff --git a/TestStack.Dossier.Tests/EquivalenceClasses/AddressUsEquivalenceTests.cs b/TestStack.Dossier.Tests/EquivalenceClasses/AddressUsEquivalenceTests.cs new file mode 100644 index 0000000..7b731b6 --- /dev/null +++ b/TestStack.Dossier.Tests/EquivalenceClasses/AddressUsEquivalenceTests.cs @@ -0,0 +1,48 @@ +using System.Collections.Generic; +using TestStack.Dossier.DataSources; +using TestStack.Dossier.DataSources.Dictionaries; +using Xunit.Extensions; + +namespace TestStack.Dossier.Tests.EquivalenceClasses +{ + public class AddressUsEquivalenceTests : FileDictionaryEquivalenceTests + { + [Theory] + [ClassData(typeof(AddressUsTestCases))] + public override void WhenGettingAnyData_ThenReturnRandomDataWhichIsReasonablyUnique(DataSource source, List testCases) + { + base.WhenGettingAnyData_ThenReturnRandomDataWhichIsReasonablyUnique(source, testCases); + } + } + + public class AddressUsTestCases : FileDictionaryEquivalenceTestCases + { + protected override List GetData() + { + return new List + { + new object[] + {new Words(FromDictionary.AddressUsCity), GenerateTestCasesForSut(Any.AddressUsCity)}, + new object[] + {new Words(FromDictionary.AddressUsCompany), GenerateTestCasesForSut(Any.AddressUsCompany)}, + new object[] + {new Words(FromDictionary.AddressUsPhone), GenerateTestCasesForSut(Any.AddressUsPhone)}, + new object[] + {new Words(FromDictionary.AddressUsSocialSecurityNumber), GenerateTestCasesForSut(Any.AddressUsSocialSecurityNumber)}, + new object[] + {new Words(FromDictionary.AddressUsState), GenerateTestCasesForSut(Any.AddressUsState)}, + new object[] + { + new Words(FromDictionary.AddressUsStateAbbreviation), + GenerateTestCasesForSut(Any.AddressUsStateAbbreviation) + }, + new object[] + {new Words(FromDictionary.AddressUsStreet), GenerateTestCasesForSut(Any.AddressUsStreet)}, + new object[] + {new Words(FromDictionary.AddressUsWebsite), GenerateTestCasesForSut(Any.AddressUsWebsite)}, + new object[] + {new Words(FromDictionary.AddressUsZipCode), GenerateTestCasesForSut(Any.AddressUsZipCode)} + }; + } + } +} diff --git a/TestStack.Dossier.Tests/EquivalenceClasses/ColourEquivalenceTests.cs b/TestStack.Dossier.Tests/EquivalenceClasses/ColourEquivalenceTests.cs new file mode 100644 index 0000000..09db335 --- /dev/null +++ b/TestStack.Dossier.Tests/EquivalenceClasses/ColourEquivalenceTests.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; +using TestStack.Dossier.DataSources; +using TestStack.Dossier.DataSources.Dictionaries; +using Xunit.Extensions; + +namespace TestStack.Dossier.Tests.EquivalenceClasses +{ + public class ColourEquivalenceTests : FileDictionaryEquivalenceTests + { + [Theory] + [ClassData(typeof(ColourTestCases))] + public override void WhenGettingAnyData_ThenReturnRandomDataWhichIsReasonablyUnique(DataSource source, List testCases) + { + base.WhenGettingAnyData_ThenReturnRandomDataWhichIsReasonablyUnique(source, testCases); + } + } + + public class ColourTestCases : FileDictionaryEquivalenceTestCases + { + protected override List GetData() + { + return new List + { + new object[] + {new Words(FromDictionary.ColourHex), GenerateTestCasesForSut(Any.ColourHex)}, + new object[] + {new Words(FromDictionary.ColourName), GenerateTestCasesForSut(Any.ColourName)} + }; + } + } +} diff --git a/TestStack.Dossier.Tests/EquivalenceClasses/CompanyEquivalenceTests.cs b/TestStack.Dossier.Tests/EquivalenceClasses/CompanyEquivalenceTests.cs new file mode 100644 index 0000000..c721ee8 --- /dev/null +++ b/TestStack.Dossier.Tests/EquivalenceClasses/CompanyEquivalenceTests.cs @@ -0,0 +1,35 @@ +using System.Collections.Generic; +using TestStack.Dossier.DataSources; +using TestStack.Dossier.DataSources.Dictionaries; +using Xunit.Extensions; + +namespace TestStack.Dossier.Tests.EquivalenceClasses +{ + public class CompanyEquivalenceTests : FileDictionaryEquivalenceTests + { + [Theory] + [ClassData(typeof(CompanyTestCases))] + public override void WhenGettingAnyData_ThenReturnRandomDataWhichIsReasonablyUnique(DataSource source, List testCases) + { + base.WhenGettingAnyData_ThenReturnRandomDataWhichIsReasonablyUnique(source, testCases); + } + } + + public class CompanyTestCases : FileDictionaryEquivalenceTestCases + { + protected override List GetData() + { + return new List + { + new object[] + {new Words(FromDictionary.CompanyName), GenerateTestCasesForSut(Any.CompanyName)}, + new object[] + {new Words(FromDictionary.CompanyIndustry), GenerateTestCasesForSut(Any.CompanyIndustry)}, + new object[] + {new Words(FromDictionary.CompanyJobTitle), GenerateTestCasesForSut(Any.CompanyJobTitle)}, + new object[] + {new Words(FromDictionary.CompanyLocation), GenerateTestCasesForSut(Any.CompanyLocation)} + }; + } + } +} diff --git a/TestStack.Dossier.Tests/EquivalenceClasses/FileDictionaryEquivalenceTestCases.cs b/TestStack.Dossier.Tests/EquivalenceClasses/FileDictionaryEquivalenceTestCases.cs new file mode 100644 index 0000000..315e23b --- /dev/null +++ b/TestStack.Dossier.Tests/EquivalenceClasses/FileDictionaryEquivalenceTestCases.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace TestStack.Dossier.Tests.EquivalenceClasses +{ + public abstract class FileDictionaryEquivalenceTestCases : IEnumerable + { + protected abstract List GetData(); + + protected AnonymousValueFixture Any = new AnonymousValueFixture(); + + private List _data; + public List Data + { + get + { + if (_data == null) + { + _data = GetData(); + } + return _data; + } + } + + protected List GenerateTestCasesForSut(Func any) + { + var results = new List(); + for (int i = 0; i < 10; i++) + { + results.Add(any()); + } + return results; + } + + public IEnumerator GetEnumerator() + { + return Data.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} \ No newline at end of file diff --git a/TestStack.Dossier.Tests/EquivalenceClasses/FileDictionaryEquivalenceTests.cs b/TestStack.Dossier.Tests/EquivalenceClasses/FileDictionaryEquivalenceTests.cs new file mode 100644 index 0000000..5ab0c3d --- /dev/null +++ b/TestStack.Dossier.Tests/EquivalenceClasses/FileDictionaryEquivalenceTests.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; +using System.Linq; +using Shouldly; +using TestStack.Dossier.DataSources; + +namespace TestStack.Dossier.Tests.EquivalenceClasses +{ + public abstract class FileDictionaryEquivalenceTests + { + protected AnonymousValueFixture Any = new AnonymousValueFixture(); + + public virtual void WhenGettingAnyData_ThenReturnRandomDataWhichIsReasonablyUnique(DataSource source, + List testCases) + { + foreach (var testCase in testCases) + { + testCase.ShouldBeOfType(); + testCase.ShouldNotBeNullOrEmpty(); + source.Data.ShouldContain(testCase); + } + if (source.Data.Count > 15) + { + var unique = testCases.Distinct().Count(); + unique.ShouldBeGreaterThan(5); + } + } + } +} \ No newline at end of file diff --git a/TestStack.Dossier.Tests/EquivalenceClasses/FinanceEquivalenceTests.cs b/TestStack.Dossier.Tests/EquivalenceClasses/FinanceEquivalenceTests.cs new file mode 100644 index 0000000..05caa41 --- /dev/null +++ b/TestStack.Dossier.Tests/EquivalenceClasses/FinanceEquivalenceTests.cs @@ -0,0 +1,35 @@ +using System.Collections.Generic; +using TestStack.Dossier.DataSources; +using TestStack.Dossier.DataSources.Dictionaries; +using Xunit.Extensions; + +namespace TestStack.Dossier.Tests.EquivalenceClasses +{ + public class FinanceEquivalenceTests : FileDictionaryEquivalenceTests + { + [Theory] + [ClassData(typeof(FinanceTestCases))] + public override void WhenGettingAnyData_ThenReturnRandomDataWhichIsReasonablyUnique(DataSource source, List testCases) + { + base.WhenGettingAnyData_ThenReturnRandomDataWhichIsReasonablyUnique(source, testCases); + } + } + + public class FinanceTestCases : FileDictionaryEquivalenceTestCases + { + protected override List GetData() + { + return new List + { + new object[] + {new Words(FromDictionary.FinanceCreditCardNumber), GenerateTestCasesForSut(Any.FinanceCreditCardNumber)}, + new object[] + {new Words(FromDictionary.FinanceCreditCardType), GenerateTestCasesForSut(Any.FinanceCreditCardType)}, + new object[] + {new Words(FromDictionary.FinanceCurrency), GenerateTestCasesForSut(Any.FinanceCurrency)}, + new object[] + {new Words(FromDictionary.FinanceCurrencyCode), GenerateTestCasesForSut(Any.FinanceCurrencyCode)} + }; + } + } +} diff --git a/TestStack.Dossier.Tests/EquivalenceClasses/FrequencyEquivalenceTests.cs b/TestStack.Dossier.Tests/EquivalenceClasses/FrequencyEquivalenceTests.cs new file mode 100644 index 0000000..d817874 --- /dev/null +++ b/TestStack.Dossier.Tests/EquivalenceClasses/FrequencyEquivalenceTests.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; +using TestStack.Dossier.DataSources; +using TestStack.Dossier.DataSources.Dictionaries; +using Xunit.Extensions; + +namespace TestStack.Dossier.Tests.EquivalenceClasses +{ + public class FrequencyEquivalenceTests : FileDictionaryEquivalenceTests + { + [Theory] + [ClassData(typeof(FrequencyTestCases))] + public override void WhenGettingAnyData_ThenReturnRandomDataWhichIsReasonablyUnique(DataSource source, List testCases) + { + base.WhenGettingAnyData_ThenReturnRandomDataWhichIsReasonablyUnique(source, testCases); + } + } + + public class FrequencyTestCases : FileDictionaryEquivalenceTestCases + { + protected override List GetData() + { + return new List + { + new object[] + {new Words(FromDictionary.Frequency), GenerateTestCasesForSut(Any.Frequency)} + }; + } + } +} diff --git a/TestStack.Dossier.Tests/EquivalenceClasses/GeoEquivalenceClassesTests.cs b/TestStack.Dossier.Tests/EquivalenceClasses/GeoEquivalenceClassesTests.cs index c5fa667..d48a7d1 100644 --- a/TestStack.Dossier.Tests/EquivalenceClasses/GeoEquivalenceClassesTests.cs +++ b/TestStack.Dossier.Tests/EquivalenceClasses/GeoEquivalenceClassesTests.cs @@ -1,62 +1,33 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using Shouldly; +using System.Collections.Generic; using TestStack.Dossier.DataSources; -using TestStack.Dossier.DataSources.Geography; +using TestStack.Dossier.DataSources.Dictionaries; using TestStack.Dossier.EquivalenceClasses.Geo; -using Xunit; using Xunit.Extensions; namespace TestStack.Dossier.Tests.EquivalenceClasses { - public class GeoEquivalenceClassesTests + public class GeoEquivalenceClassesTests : FileDictionaryEquivalenceTests { - public static AnonymousValueFixture Any { get; private set; } - - public GeoEquivalenceClassesTests() - { - Any = new AnonymousValueFixture(); - } - [Theory] - [PropertyData("TestCases")] - public void WhenGettingAnyGeoData_ThenReturnRandomGeoDataWhichIsReasonablyUnique(DataSource source, - List testCases) + [ClassData(typeof(GeographyTestCases))] + public override void WhenGettingAnyData_ThenReturnRandomDataWhichIsReasonablyUnique(DataSource source, List testCases) { - foreach (var testCase in testCases) - { - testCase.ShouldBeOfType(); - testCase.ShouldNotBeNullOrEmpty(); - source.Data.ShouldContain(testCase); - } - if (source.Data.Count > 15) - { - var unique = testCases.Distinct().Count(); - unique.ShouldBeGreaterThan(5); - } + base.WhenGettingAnyData_ThenReturnRandomDataWhichIsReasonablyUnique(source, testCases); } + } - public static IEnumerable TestCases + public class GeographyTestCases : FileDictionaryEquivalenceTestCases + { + protected override List GetData() { - get + return new List { - yield return new object[] { new GeoContinentSource(), GenerateTestCasesForSut(Any.Continent) }; - yield return new object[] { new GeoCountrySource(), GenerateTestCasesForSut(Any.Country) }; - yield return new object[] { new GeoCountryCodeSource(), GenerateTestCasesForSut(Any.CountryCode) }; - yield return new object[] { new GeoLatitudeSource(), GenerateTestCasesForSut(Any.Latitude) }; - yield return new object[] { new GeoLongitudeSource(), GenerateTestCasesForSut(Any.Longitude) }; - } + new object[] {new Words(FromDictionary.GeoContinent), GenerateTestCasesForSut(Any.Continent)}, + new object[] {new Words(FromDictionary.GeoCountry), GenerateTestCasesForSut(Any.Country)}, + new object[] {new Words(FromDictionary.GeoCountryCode), GenerateTestCasesForSut(Any.CountryCode)}, + new object[] {new Words(FromDictionary.GeoLatitude), GenerateTestCasesForSut(Any.Latitude)}, + new object[] {new Words(FromDictionary.GeoLongitude), GenerateTestCasesForSut(Any.Longitude)}, + }; } - - private static List GenerateTestCasesForSut(Func any) - { - var results = new List(); - for (int i = 0; i < 10; i++) - { - results.Add(any()); - } - return results; - } } } diff --git a/TestStack.Dossier.Tests/EquivalenceClasses/GeoEquivalenceTests.cs b/TestStack.Dossier.Tests/EquivalenceClasses/GeoEquivalenceTests.cs new file mode 100644 index 0000000..dd6c021 --- /dev/null +++ b/TestStack.Dossier.Tests/EquivalenceClasses/GeoEquivalenceTests.cs @@ -0,0 +1,32 @@ +using System.Collections.Generic; +using TestStack.Dossier.DataSources; +using TestStack.Dossier.DataSources.Dictionaries; +using Xunit.Extensions; + +namespace TestStack.Dossier.Tests.EquivalenceClasses +{ + public class GeoEquivalenceTests : FileDictionaryEquivalenceTests + { + [Theory] + [ClassData(typeof(GeoTestCases))] + public override void WhenGettingAnyData_ThenReturnRandomDataWhichIsReasonablyUnique(DataSource source, List testCases) + { + base.WhenGettingAnyData_ThenReturnRandomDataWhichIsReasonablyUnique(source, testCases); + } + } + + public class GeoTestCases : FileDictionaryEquivalenceTestCases + { + protected override List GetData() + { + return new List + { + new object[] {new Words(FromDictionary.GeoContinent), GenerateTestCasesForSut(Any.GeoContinent)}, + new object[] {new Words(FromDictionary.GeoCountry), GenerateTestCasesForSut(Any.GeoCountry)}, + new object[] {new Words(FromDictionary.GeoCountryCode), GenerateTestCasesForSut(Any.GeoCountryCode)}, + new object[] {new Words(FromDictionary.GeoLatitude), GenerateTestCasesForSut(Any.GeoLatitude)}, + new object[] {new Words(FromDictionary.GeoLongitude), GenerateTestCasesForSut(Any.GeoLongitude)}, + }; + } + } +} diff --git a/TestStack.Dossier.Tests/EquivalenceClasses/IdentifierEquivalenceTests.cs b/TestStack.Dossier.Tests/EquivalenceClasses/IdentifierEquivalenceTests.cs new file mode 100644 index 0000000..22725f5 --- /dev/null +++ b/TestStack.Dossier.Tests/EquivalenceClasses/IdentifierEquivalenceTests.cs @@ -0,0 +1,49 @@ +using System.Collections.Generic; +using TestStack.Dossier.DataSources; +using TestStack.Dossier.DataSources.Dictionaries; +using Xunit.Extensions; + +namespace TestStack.Dossier.Tests.EquivalenceClasses +{ + public class IdentifierEquivalenceTests : FileDictionaryEquivalenceTests + { + [Theory] + [ClassData(typeof(IdentifierTestCases))] + public override void WhenGettingAnyData_ThenReturnRandomDataWhichIsReasonablyUnique(DataSource source, List testCases) + { + base.WhenGettingAnyData_ThenReturnRandomDataWhichIsReasonablyUnique(source, testCases); + } + } + + public class IdentifierTestCases : FileDictionaryEquivalenceTestCases + { + protected override List GetData() + { + return new List + { + new object[] + { + new Words(FromDictionary.IdentifierBitcoinAddress), + GenerateTestCasesForSut(Any.IdentifierBitcoinAddress) + }, + new object[] + {new Words(FromDictionary.IdentifierIban), GenerateTestCasesForSut(Any.IdentifierIban)}, + new object[] + { + new Words(FromDictionary.IdentifierIpAddressV4), GenerateTestCasesForSut(Any.IdentifierIpAddressV4) + }, + new object[] + { + new Words(FromDictionary.IdentifierIpAddressV6), GenerateTestCasesForSut(Any.IdentifierIpAddressV6) + }, + new object[] + {new Words(FromDictionary.IdentifierIsbn), GenerateTestCasesForSut(Any.IdentifierIsbn)}, + new object[] + { + new Words(FromDictionary.IdentifierMacAddress), + GenerateTestCasesForSut(Any.IdentifierMacAddress) + } + }; + } + } +} diff --git a/TestStack.Dossier.Tests/EquivalenceClasses/IntegerEquivalenceTests.cs b/TestStack.Dossier.Tests/EquivalenceClasses/IntegerEquivalenceTests.cs new file mode 100644 index 0000000..2630029 --- /dev/null +++ b/TestStack.Dossier.Tests/EquivalenceClasses/IntegerEquivalenceTests.cs @@ -0,0 +1,41 @@ +using System.Collections.Generic; +using TestStack.Dossier.DataSources; +using TestStack.Dossier.DataSources.Dictionaries; +using Xunit.Extensions; + +namespace TestStack.Dossier.Tests.EquivalenceClasses +{ + public class InternetEquivalenceTests : FileDictionaryEquivalenceTests + { + [Theory] + [ClassData(typeof(InternetTestCases))] + public override void WhenGettingAnyData_ThenReturnRandomDataWhichIsReasonablyUnique(DataSource source, List testCases) + { + base.WhenGettingAnyData_ThenReturnRandomDataWhichIsReasonablyUnique(source, testCases); + } + } + + public class InternetTestCases : FileDictionaryEquivalenceTestCases + { + protected override List GetData() + { + return new List + { + new object[] + { + new Words(FromDictionary.InternetDomainCountryCodeTopLevelDomain), + GenerateTestCasesForSut(Any.InternetDomainCountryCodeTopLevelDomain) + }, + new object[] + {new Words(FromDictionary.InternetDomainName), GenerateTestCasesForSut(Any.InternetDomainName)}, + new object[] + { + new Words(FromDictionary.InternetDomainTopLevel), + GenerateTestCasesForSut(Any.InternetDomainTopLevel) + }, + new object[] + {new Words(FromDictionary.InternetUrl), GenerateTestCasesForSut(Any.InternetUrl)} + }; + } + } +} diff --git a/TestStack.Dossier.Tests/EquivalenceClasses/LoremIpsumEquivalenceTests.cs b/TestStack.Dossier.Tests/EquivalenceClasses/LoremIpsumEquivalenceTests.cs new file mode 100644 index 0000000..0e97f89 --- /dev/null +++ b/TestStack.Dossier.Tests/EquivalenceClasses/LoremIpsumEquivalenceTests.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; +using TestStack.Dossier.DataSources; +using TestStack.Dossier.DataSources.Dictionaries; +using Xunit.Extensions; + +namespace TestStack.Dossier.Tests.EquivalenceClasses +{ + public class LoremIpsumEquivalenceTests : FileDictionaryEquivalenceTests + { + [Theory] + [ClassData(typeof(LoremIpsumTestCases))] + public override void WhenGettingAnyData_ThenReturnRandomDataWhichIsReasonablyUnique(DataSource source, List testCases) + { + base.WhenGettingAnyData_ThenReturnRandomDataWhichIsReasonablyUnique(source, testCases); + } + } + + public class LoremIpsumTestCases : FileDictionaryEquivalenceTestCases + { + protected override List GetData() + { + return new List + { + new object[] + {new Words(FromDictionary.LoremIpsum), GenerateTestCasesForSut(Any.LoremIpsum)} + }; + } + } +} diff --git a/TestStack.Dossier.Tests/EquivalenceClasses/PersonEquivalenceClassesTests.cs b/TestStack.Dossier.Tests/EquivalenceClasses/PersonEquivalenceClassesTests.cs index 81db6dd..81c3d94 100644 --- a/TestStack.Dossier.Tests/EquivalenceClasses/PersonEquivalenceClassesTests.cs +++ b/TestStack.Dossier.Tests/EquivalenceClasses/PersonEquivalenceClassesTests.cs @@ -1,49 +1,31 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using Shouldly; using TestStack.Dossier.DataSources; -using TestStack.Dossier.DataSources.Person; +using TestStack.Dossier.DataSources.Dictionaries; using TestStack.Dossier.EquivalenceClasses.Person; using Xunit; using Xunit.Extensions; namespace TestStack.Dossier.Tests.EquivalenceClasses { - public class PersonEquivalenceClassesTests + public class PersonEquivalenceClassesTests : FileDictionaryEquivalenceTests { - public static AnonymousValueFixture Any { get; private set; } - - public PersonEquivalenceClassesTests() - { - Any = new AnonymousValueFixture(); - } - [Theory] - [PropertyData("TestCases")] - public void WhenGettingAnyPersonData_ThenReturnRandomPersonDataWhichIsReasonablyUnique(DataSource source, - List testCases) + [ClassData(typeof(PersonTestCases2))] + public override void WhenGettingAnyData_ThenReturnRandomDataWhichIsReasonablyUnique(DataSource source, List testCases) { - foreach (var testCase in testCases) - { - testCase.ShouldBeOfType(); - testCase.ShouldNotBeNullOrEmpty(); - source.Data.ShouldContain(testCase); - } - if (source.Data.Count > 15) - { - var unique = testCases.Distinct().Count(); - unique.ShouldBeGreaterThan(5); - } + base.WhenGettingAnyData_ThenReturnRandomDataWhichIsReasonablyUnique(source, testCases); } [Fact] public void WhenGettingUniqueEmail_ThenReturnUniqueEmailsAcrossFixtureInstances() { - var source = new PersonEmailAddressSource(); + var source = new Words(FromDictionary.PersonEmailAddress); var generatedValues = new List(); var any2 = new AnonymousValueFixture(); + any2.ResetUniqueEmailAddressSource(); generatedValues.Add(any2.UniqueEmailAddress()); for (var i = 0; i < source.Data.Count - 1; i++) { @@ -53,31 +35,28 @@ public void WhenGettingUniqueEmail_ThenReturnUniqueEmailsAcrossFixtureInstances( generatedValues.Distinct().Count() .ShouldBe(generatedValues.Count); } + } - public static IEnumerable TestCases + public class PersonTestCases2 : FileDictionaryEquivalenceTestCases + { + protected override List GetData() { - get + return new List { - yield return new object[] { new PersonEmailAddressSource(), GenerateTestCasesForSut(Any.EmailAddress) }; - yield return new object[] { new PersonLanguageSource(), GenerateTestCasesForSut(Any.Language) }; - yield return new object[] { new PersonNameFirstFemaleSource(), GenerateTestCasesForSut(Any.FemaleFirstName) }; - yield return new object[] { new PersonNameFirstSource(), GenerateTestCasesForSut(Any.FirstName) }; - yield return new object[] { new PersonNameFullSource(), GenerateTestCasesForSut(Any.FullName) }; - yield return new object[] { new PersonNameLastSource(), GenerateTestCasesForSut(Any.LastName) }; - yield return new object[] { new PersonNameFirstMaleSource(), GenerateTestCasesForSut(Any.MaleFirstName) }; - yield return new object[] { new PersonNameSuffixSource(), GenerateTestCasesForSut(Any.Suffix) }; - yield return new object[] { new PersonNameTitleSource(), GenerateTestCasesForSut(Any.Title) }; - } + new object[] + {new Words(FromDictionary.PersonEmailAddress), GenerateTestCasesForSut(Any.EmailAddress)}, + new object[] {new Words(FromDictionary.PersonLanguage), GenerateTestCasesForSut(Any.Language)}, + new object[] + {new Words(FromDictionary.PersonNameFirstFemale), GenerateTestCasesForSut(Any.FemaleFirstName)}, + new object[] {new Words(FromDictionary.PersonNameFirst), GenerateTestCasesForSut(Any.FirstName)}, + new object[] {new Words(FromDictionary.PersonNameFull), GenerateTestCasesForSut(Any.FullName)}, + new object[] {new Words(FromDictionary.PersonNameLast), GenerateTestCasesForSut(Any.LastName)}, + new object[] + {new Words(FromDictionary.PersonNameFirstMale), GenerateTestCasesForSut(Any.MaleFirstName)}, + new object[] {new Words(FromDictionary.PersonNameSuffix), GenerateTestCasesForSut(Any.Suffix)}, + new object[] {new Words(FromDictionary.PersonNameTitle), GenerateTestCasesForSut(Any.Title)}, + }; } - - private static List GenerateTestCasesForSut(Func any) - { - var results = new List(); - for (int i = 0; i < 10; i++) - { - results.Add(any()); - } - return results; - } } + } diff --git a/TestStack.Dossier.Tests/EquivalenceClasses/PersonEquivalenceTests.cs b/TestStack.Dossier.Tests/EquivalenceClasses/PersonEquivalenceTests.cs new file mode 100644 index 0000000..2d27f95 --- /dev/null +++ b/TestStack.Dossier.Tests/EquivalenceClasses/PersonEquivalenceTests.cs @@ -0,0 +1,60 @@ +using System.Collections.Generic; +using System.Linq; +using Shouldly; +using TestStack.Dossier.DataSources; +using TestStack.Dossier.DataSources.Dictionaries; +using Xunit; +using Xunit.Extensions; + +namespace TestStack.Dossier.Tests.EquivalenceClasses +{ + public class PersonEquivalenceTests : FileDictionaryEquivalenceTests + { + [Theory] + [ClassData(typeof(PersonTestCases))] + public override void WhenGettingAnyData_ThenReturnRandomDataWhichIsReasonablyUnique(DataSource source, List testCases) + { + base.WhenGettingAnyData_ThenReturnRandomDataWhichIsReasonablyUnique(source, testCases); + } + + [Fact] + public void WhenGettingUniqueEmail_ThenReturnUniqueEmailsAcrossFixtureInstances() + { + var source = new Words(FromDictionary.PersonEmailAddress); + var generatedValues = new List(); + var any2 = new AnonymousValueFixture(); + + any2.ResetUniqueEmailAddressSource(); + generatedValues.Add(any2.PersonUniqueEmailAddress()); + for (var i = 0; i < source.Data.Count - 1; i++) + { + generatedValues.Add(Any.PersonUniqueEmailAddress()); + } + + generatedValues.Distinct().Count() + .ShouldBe(generatedValues.Count); + } + } + + public class PersonTestCases : FileDictionaryEquivalenceTestCases + { + protected override List GetData() + { + return new List + { + new object[] + {new Words(FromDictionary.PersonEmailAddress), GenerateTestCasesForSut(Any.PersonEmailAddress)}, + new object[] {new Words(FromDictionary.PersonLanguage), GenerateTestCasesForSut(Any.PersonLanguage)}, + new object[] + {new Words(FromDictionary.PersonNameFirstFemale), GenerateTestCasesForSut(Any.PersonNameFirstFemale)}, + new object[] {new Words(FromDictionary.PersonNameFirst), GenerateTestCasesForSut(Any.PersonNameFirst)}, + new object[] {new Words(FromDictionary.PersonNameFull), GenerateTestCasesForSut(Any.PersonNameFull)}, + new object[] {new Words(FromDictionary.PersonNameLast), GenerateTestCasesForSut(Any.PersonNameLast)}, + new object[] + {new Words(FromDictionary.PersonNameFirstMale), GenerateTestCasesForSut(Any.PersonNameFirstMale)}, + new object[] {new Words(FromDictionary.PersonNameSuffix), GenerateTestCasesForSut(Any.PersonNameSuffix)}, + new object[] {new Words(FromDictionary.PersonNameTitle), GenerateTestCasesForSut(Any.PersonNameTitle)}, + }; + } + } +} diff --git a/TestStack.Dossier.Tests/EquivalenceClasses/ShirtSizeEquivalenceTests.cs b/TestStack.Dossier.Tests/EquivalenceClasses/ShirtSizeEquivalenceTests.cs new file mode 100644 index 0000000..d5b8bf9 --- /dev/null +++ b/TestStack.Dossier.Tests/EquivalenceClasses/ShirtSizeEquivalenceTests.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; +using TestStack.Dossier.DataSources; +using TestStack.Dossier.DataSources.Dictionaries; +using Xunit.Extensions; + +namespace TestStack.Dossier.Tests.EquivalenceClasses +{ + public class ShirtSizeEquivalenceTests : FileDictionaryEquivalenceTests + { + [Theory] + [ClassData(typeof(ShirtSizeTestCases))] + public override void WhenGettingAnyData_ThenReturnRandomDataWhichIsReasonablyUnique(DataSource source, List testCases) + { + base.WhenGettingAnyData_ThenReturnRandomDataWhichIsReasonablyUnique(source, testCases); + } + } + + public class ShirtSizeTestCases : FileDictionaryEquivalenceTestCases + { + protected override List GetData() + { + return new List + { + new object[] + {new Words(FromDictionary.ShirtSize), GenerateTestCasesForSut(Any.ShirtSize)} + }; + } + } +} diff --git a/TestStack.Dossier.Tests/GetAnonymousTests.cs b/TestStack.Dossier.Tests/GetAnonymousTests.cs index b5a0ddf..3a2203e 100644 --- a/TestStack.Dossier.Tests/GetAnonymousTests.cs +++ b/TestStack.Dossier.Tests/GetAnonymousTests.cs @@ -1,6 +1,6 @@ using System; using Shouldly; -using TestStack.Dossier.DataSources.Person; +using TestStack.Dossier.DataSources.Dictionaries; using TestStack.Dossier.Lists; using TestStack.Dossier.Tests.TestHelpers; using TestStack.Dossier.Tests.TestHelpers.Builders; @@ -55,7 +55,7 @@ public void GivenNoValueHasBeenSetForAPropertyNamedFirstName_WhenRetrievingTheVa { var firstName = _b.Get(x => x.FirstName); - new PersonNameFirstSource().Data + new Words(FromDictionary.PersonNameFirst).Data .ShouldContain(firstName); } @@ -64,7 +64,7 @@ public void GivenNoValueHasBeenSetForAPropertyNamedLastName_WhenRetrievingTheVal { var lastName = _b.Get(x => x.LastName); - new PersonNameLastSource().Data + new Words(FromDictionary.PersonNameLast).Data .ShouldContain(lastName); } diff --git a/TestStack.Dossier.Tests/PublicApiApproval/PublicApiApproverTests.GivenDossierAssembly_WhenPublicApiChecked_ShouldHaveNoChanges.approved.txt b/TestStack.Dossier.Tests/PublicApiApproval/PublicApiApproverTests.GivenDossierAssembly_WhenPublicApiChecked_ShouldHaveNoChanges.approved.txt new file mode 100644 index 0000000..a372623 --- /dev/null +++ b/TestStack.Dossier.Tests/PublicApiApproval/PublicApiApproverTests.GivenDossierAssembly_WhenPublicApiChecked_ShouldHaveNoChanges.approved.txt @@ -0,0 +1,601 @@ +[assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute("DynamicProxyGenAssembly2")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute("TestStack.Dossier.Tests")] +[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly: System.Runtime.InteropServices.GuidAttribute("24a139fb-b390-4f14-9be6-cf9fb354bb5d")] +[assembly: System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.0", FrameworkDisplayName=".NET Framework 4")] + +namespace TestStack.Dossier +{ + + public class static AddressAusEquivalence + { + public static string AddressAusCity(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string AddressAusCompany(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string AddressAusPhone(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string AddressAusPostCode(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string AddressAusState(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string AddressAusStateAbbreviation(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string AddressAusStreet(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string AddressAusWebsite(this TestStack.Dossier.AnonymousValueFixture fixture) { } + } + public class static AddressUkEquivalence + { + public static string AddressUkCity(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string AddressUkCompany(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string AddressUkCounty(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string AddressUkPhone(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string AddressUkPostCode(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string AddressUkStreet(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string AddressUkWebsite(this TestStack.Dossier.AnonymousValueFixture fixture) { } + } + public class static AddressUsEquivalence + { + public static string AddressUsCity(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string AddressUsCompany(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string AddressUsPhone(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string AddressUsSocialSecurityNumber(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string AddressUsState(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string AddressUsStateAbbreviation(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string AddressUsStreet(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string AddressUsWebsite(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string AddressUsZipCode(this TestStack.Dossier.AnonymousValueFixture fixture) { } + } + public class AnonymousValueFixture + { + public AnonymousValueFixture() { } + [System.Runtime.CompilerServices.DynamicAttribute()] + public object Bag { get; } + public static System.Collections.Generic.IEnumerable DefaultValueSuppliers { get; } + public Ploeh.AutoFixture.Fixture Fixture { get; } + public static System.Collections.Generic.ICollection GlobalValueSuppliers { get; } + public System.Collections.Generic.ICollection LocalValueSuppliers { get; } + public Ploeh.AutoFixture.RegularExpressionGenerator RegexGenerator { get; } + public T Get(System.Linq.Expressions.Expression> property) { } + public object Get(System.Type type, string propertyName) { } + public TestStack.Dossier.DataSources.Dictionaries.Words Words(string dictionaryName) { } + } + public class Builder : TestStack.Dossier.TestDataBuilder> + where T : class + { + public Builder() { } + protected override T BuildObject() { } + public static TestStack.Dossier.Lists.ListBuilder> CreateListOfSize(int size, TestStack.Dossier.Factories.IFactory factory) { } + public static TestStack.Dossier.Builder CreateNew(TestStack.Dossier.Factories.IFactory factory = null) { } + public virtual TestStack.Dossier.Builder SetUsingBuilder(System.Linq.Expressions.Expression> property, System.Func modifier = null) + where TPropertyType : class + where TPropertyBuilder : TestStack.Dossier.TestDataBuilder<, >, new () { } + public virtual TestStack.Dossier.Builder SetUsingBuilder(System.Linq.Expressions.Expression> property, System.Func, TestStack.Dossier.Builder> modifier = null) + where TPropertyType : class { } + } + public class static ColourEquivalence + { + public static string ColourHex(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string ColourName(this TestStack.Dossier.AnonymousValueFixture fixture) { } + } + public class static CompanyEquivalence + { + public static string CompanyIndustry(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string CompanyJobTitle(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string CompanyLocation(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string CompanyName(this TestStack.Dossier.AnonymousValueFixture fixture) { } + } + public class static FinanceEquivalence + { + public static string FinanceCreditCardNumber(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string FinanceCreditCardType(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string FinanceCurrency(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string FinanceCurrencyCode(this TestStack.Dossier.AnonymousValueFixture fixture) { } + } + public class static FrequencyEquivalence + { + public static string Frequency(this TestStack.Dossier.AnonymousValueFixture fixture) { } + } + public class static GeoEquivalence + { + public static string GeoContinent(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string GeoCountry(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string GeoCountryCode(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string GeoLatitude(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string GeoLongitude(this TestStack.Dossier.AnonymousValueFixture fixture) { } + } + public interface IAnonymousValueSupplier + { + bool CanSupplyValue(System.Type type, string propertyName); + object GenerateAnonymousValue(TestStack.Dossier.AnonymousValueFixture any, System.Type type, string propertyName); + } + public class static IdentifierEquivalence + { + public static string IdentifierBitcoinAddress(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string IdentifierIban(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string IdentifierIpAddressV4(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string IdentifierIpAddressV6(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string IdentifierIsbn(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string IdentifierMacAddress(this TestStack.Dossier.AnonymousValueFixture fixture) { } + } + public class static InternetEquivalence + { + public static string InternetDomainCountryCodeTopLevelDomain(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string InternetDomainName(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string InternetDomainTopLevel(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string InternetUrl(this TestStack.Dossier.AnonymousValueFixture fixture) { } + } + public interface ITestDataBuilder + where out TObject : class + { + TObject Build(); + } + public class static LoremIpsumEquivalence + { + public static string LoremIpsum(this TestStack.Dossier.AnonymousValueFixture fixture) { } + } + public class static PersonEquivalence + { + public static string PersonEmailAddress(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string PersonLanguage(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string PersonNameFirst(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string PersonNameFirstFemale(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string PersonNameFirstMale(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string PersonNameFull(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string PersonNameLast(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string PersonNameSuffix(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string PersonNameTitle(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string PersonPassword(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string PersonRace(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string PersonUniqueEmailAddress(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string PersonUsername(this TestStack.Dossier.AnonymousValueFixture fixture) { } + } + public class ProxyBuilder + where T : class + { + public ProxyBuilder(System.Collections.Generic.Dictionary> properties) { } + public T Build() { } + } + public class static ShirtSizeEquivalence + { + public static string ShirtSize(this TestStack.Dossier.AnonymousValueFixture fixture) { } + } + public abstract class TestDataBuilder : TestStack.Dossier.ITestDataBuilder + where TObject : class + where TBuilder : TestStack.Dossier.TestDataBuilder<, >, new () + { + protected TestDataBuilder() { } + public TestStack.Dossier.AnonymousValueFixture Any { get; } + public TestStack.Dossier.Lists.ListBuilder ListBuilder { get; } + protected virtual void AlterProxy(TObject proxy) { } + public TBuilder AsProxy() { } + public TObject Build() { } + protected virtual TObject BuildObject() { } + protected TObject BuildUsing() + where TFactory : TestStack.Dossier.Factories.IFactory, new () { } + public static TestStack.Dossier.Lists.ListBuilder CreateListOfSize(int size) { } + public TValue Get(System.Linq.Expressions.Expression> property) { } + public object Get(System.Type type, string propertyName) { } + protected virtual TChildBuilder GetChildBuilder(System.Func modifier = null) + where TChildObject : class + where TChildBuilder : TestStack.Dossier.TestDataBuilder<, >, new () { } + public TValue GetOrDefault(System.Linq.Expressions.Expression> property) { } + protected bool Has(System.Linq.Expressions.Expression> property) { } + protected bool Has(string propertyName) { } + public virtual bool IsListBuilderProxy() { } + public virtual TBuilder Set(System.Linq.Expressions.Expression> property, TValue value) { } + public virtual TBuilder Set(System.Linq.Expressions.Expression> property, System.Func factory) { } + } +} +namespace TestStack.Dossier.DataSources +{ + + public abstract class DataSource : TestStack.Dossier.DataSources.IDataSource + + { + protected DataSource(TestStack.Dossier.DataSources.Generators.IGenerator generator) { } + protected DataSource() { } + public System.Collections.Generic.IList Data { get; } + public TestStack.Dossier.DataSources.Generators.IGenerator Generator { get; } + protected abstract System.Collections.Generic.IList InitializeDataSource(); + public virtual T Next() { } + } + public interface IDataSource + + { + System.Collections.Generic.IList Data { get; } + TestStack.Dossier.DataSources.Generators.IGenerator Generator { get; } + T Next(); + } +} +namespace TestStack.Dossier.DataSources.Dictionaries +{ + + [System.ObsoleteAttribute("FileDictionarySource is deprecated, please use Words(FromDictionary) instead.")] + public abstract class FileDictionarySource : TestStack.Dossier.DataSources.DataSource + { + protected FileDictionarySource() { } + protected override System.Collections.Generic.IList InitializeDataSource() { } + } + public class FromDictionary + { + public const string AddressAusCity = "AddressAusCity"; + public const string AddressAusCompany = "AddressAusCompany"; + public const string AddressAusPhone = "AddressAusPhone"; + public const string AddressAusPostCode = "AddressAusPostCode"; + public const string AddressAusState = "AddressAusState"; + public const string AddressAusStateAbbreviation = "AddressAusStateAbbreviation"; + public const string AddressAusStreet = "AddressAusStreet"; + public const string AddressAusWebsite = "AddressAusWebsite"; + public const string AddressUkCity = "AddressUKCity"; + public const string AddressUkCompany = "AddressUKCompany"; + public const string AddressUkCounty = "AddressUKCounty"; + public const string AddressUkPhone = "AddressUKPhone"; + public const string AddressUkPostCode = "AddressUKPostCode"; + public const string AddressUkStreet = "AddressUKStreet"; + public const string AddressUkWebsite = "AddressUKWebsite"; + public const string AddressUsCity = "AddressUSCity"; + public const string AddressUsCompany = "AddressUSCompany"; + public const string AddressUsPhone = "AddressUSPhone"; + public const string AddressUsSocialSecurityNumber = "AddressUSSocialSecurityNumber"; + public const string AddressUsState = "AddressUSState"; + public const string AddressUsStateAbbreviation = "AddressUSStateAbbreviation"; + public const string AddressUsStreet = "AddressUSStreet"; + public const string AddressUsWebsite = "AddressUSWebsite"; + public const string AddressUsZipCode = "AddressUSZipCode"; + public const string ColourHex = "ColourHex"; + public const string ColourName = "ColourName"; + public const string CompanyIndustry = "CompanyIndustry"; + public const string CompanyJobTitle = "CompanyJobTitle"; + public const string CompanyLocation = "CompanyLocation"; + public const string CompanyName = "CompanyName"; + public const string FinanceCreditCardNumber = "FinanceCreditCardNumber"; + public const string FinanceCreditCardType = "FinanceCreditCardType"; + public const string FinanceCurrency = "FinanceCurrency"; + public const string FinanceCurrencyCode = "FinanceCurrencyCode"; + public const string Frequency = "Frequency"; + public const string GeoContinent = "GeoContinent"; + public const string GeoCountry = "GeoCountry"; + public const string GeoCountryCode = "GeoCountryCode"; + public const string GeoLatitude = "GeoLatitude"; + public const string GeoLongitude = "GeoLongitude"; + public const string IdentifierBitcoinAddress = "IdentifierBitcoinAddress"; + public const string IdentifierIban = "IdentifierIBAN"; + public const string IdentifierIpAddressV4 = "IdentifierIPAddressV4"; + public const string IdentifierIpAddressV6 = "IdentifierIPAddressV6"; + public const string IdentifierIsbn = "IdentifierISBN"; + public const string IdentifierMacAddress = "IdentifierMacAddress"; + public const string InternetDomainCountryCodeTopLevelDomain = "InternetDomainCountryCodeTopLevelDomain"; + public const string InternetDomainName = "InternetDomainName"; + public const string InternetDomainTopLevel = "InternetDomainTopLevel"; + public const string InternetUrl = "InternetURL"; + public const string LoremIpsum = "LoremIpsum"; + public const string PersonEmailAddress = "PersonEmailAddress"; + public const string PersonLanguage = "PersonLanguage"; + public const string PersonNameFirst = "PersonNameFirst"; + public const string PersonNameFirstFemale = "PersonNameFirstFemale"; + public const string PersonNameFirstMale = "PersonNameFirstMale"; + public const string PersonNameFull = "PersonNameFull"; + public const string PersonNameLast = "PersonNameLast"; + public const string PersonNameSuffix = "PersonNameSuffix"; + public const string PersonNameTitle = "PersonNameTitle"; + public const string PersonPassword = "PersonPassword"; + public const string PersonRace = "PersonRace"; + public const string PersonUsername = "PersonUsername"; + public const string ShirtSize = "ShirtSize"; + public FromDictionary() { } + } + public class Words : TestStack.Dossier.DataSources.DataSource + { + public Words(string dictionaryName) { } + protected override System.Collections.Generic.IList InitializeDataSource() { } + } +} +namespace TestStack.Dossier.DataSources.Generators +{ + + public interface IGenerator + { + int ListSize { get; set; } + int StartIndex { get; set; } + int Generate(); + } + public class RandomGenerator : TestStack.Dossier.DataSources.Generators.IGenerator + { + public RandomGenerator() { } + public RandomGenerator(int startIndex, int listSize) { } + public int ListSize { get; set; } + public int StartIndex { get; set; } + public int Generate() { } + } + public class SequentialGenerator : TestStack.Dossier.DataSources.Generators.IGenerator + { + public SequentialGenerator() { } + public SequentialGenerator(int startIndex, int listSize, bool listShouldBeUnique = False) { } + public bool ListShouldBeUnique { get; } + public int ListSize { get; set; } + public int StartIndex { get; set; } + public int Generate() { } + } +} +namespace TestStack.Dossier.DataSources.Geography +{ + + [System.ObsoleteAttribute("GeoContinentSource is deprecated, please use Words(FromDictionary.GeoContinent) i" + + "nstead.")] + public class GeoContinentSource : TestStack.Dossier.DataSources.Dictionaries.FileDictionarySource + { + public GeoContinentSource() { } + } + [System.ObsoleteAttribute("GeoCountryCodeSource is deprecated, please use Words(FromDictionary.GeoCountryCod" + + "e) instead.")] + public class GeoCountryCodeSource : TestStack.Dossier.DataSources.Dictionaries.FileDictionarySource + { + public GeoCountryCodeSource() { } + } + [System.ObsoleteAttribute("GeoCountrySource is deprecated, please use Words(FromDictionary.GeoCountry) inste" + + "ad.")] + public class GeoCountrySource : TestStack.Dossier.DataSources.Dictionaries.FileDictionarySource + { + public GeoCountrySource() { } + } + [System.ObsoleteAttribute("GeoLatitudeSource is deprecated, please use Words(FromDictionary.GeoLatitude) ins" + + "tead.")] + public class GeoLatitudeSource : TestStack.Dossier.DataSources.Dictionaries.FileDictionarySource + { + public GeoLatitudeSource() { } + } + [System.ObsoleteAttribute("GeoLongitudeSource is deprecated, please use Words(FromDictionary.GeoLongitude) i" + + "nstead.")] + public class GeoLongitudeSource : TestStack.Dossier.DataSources.Dictionaries.FileDictionarySource + { + public GeoLongitudeSource() { } + } +} +namespace TestStack.Dossier.DataSources.Person +{ + + [System.ObsoleteAttribute("PersonEmailAddressSource is deprecated, please use Words(FromDictionary.PersonEma" + + "ilAddress) instead.")] + public class PersonEmailAddressSource : TestStack.Dossier.DataSources.Dictionaries.FileDictionarySource + { + public PersonEmailAddressSource() { } + public PersonEmailAddressSource(TestStack.Dossier.DataSources.Generators.IGenerator generator) { } + } + [System.ObsoleteAttribute("PersonLanguageSource is deprecated, please use Words(FromDictionary.PersonLanguag" + + "e) instead.")] + public class PersonLanguageSource : TestStack.Dossier.DataSources.Dictionaries.FileDictionarySource + { + public PersonLanguageSource() { } + } + [System.ObsoleteAttribute("PersonNameFirstFemaleSource is deprecated, please use Words(FromDictionary.Person" + + "NameFirstFemale) instead.")] + public class PersonNameFirstFemaleSource : TestStack.Dossier.DataSources.Dictionaries.FileDictionarySource + { + public PersonNameFirstFemaleSource() { } + } + [System.ObsoleteAttribute("PersonNameFirstMaleSource is deprecated, please use Words(FromDictionary.PersonNa" + + "meFirstMale) instead.")] + public class PersonNameFirstMaleSource : TestStack.Dossier.DataSources.Dictionaries.FileDictionarySource + { + public PersonNameFirstMaleSource() { } + } + [System.ObsoleteAttribute("PersonNameFirstSource is deprecated, please use Words(FromDictionary.PersonNameFi" + + "rst) instead.")] + public class PersonNameFirstSource : TestStack.Dossier.DataSources.Dictionaries.FileDictionarySource + { + public PersonNameFirstSource() { } + } + [System.ObsoleteAttribute("PersonNameFullSource is deprecated, please use Words(FromDictionary.PersonNameFul" + + "l) instead.")] + public class PersonNameFullSource : TestStack.Dossier.DataSources.Dictionaries.FileDictionarySource + { + public PersonNameFullSource() { } + } + [System.ObsoleteAttribute("PersonNameLastSource is deprecated, please use Words(FromDictionary.PersonNameLas" + + "t) instead.")] + public class PersonNameLastSource : TestStack.Dossier.DataSources.Dictionaries.FileDictionarySource + { + public PersonNameLastSource() { } + } + [System.ObsoleteAttribute("PersonNameSuffixSource is deprecated, please use Words(FromDictionary.PersonNameS" + + "uffix) instead.")] + public class PersonNameSuffixSource : TestStack.Dossier.DataSources.Dictionaries.FileDictionarySource + { + public PersonNameSuffixSource() { } + } + [System.ObsoleteAttribute("PersonNameTitleSource is deprecated, please use Words(FromDictionary.PersonNameTi" + + "tle) instead.")] + public class PersonNameTitleSource : TestStack.Dossier.DataSources.Dictionaries.FileDictionarySource + { + public PersonNameTitleSource() { } + } +} +namespace TestStack.Dossier.DataSources.Picking +{ + + public class Pick + { + public Pick() { } + public static TestStack.Dossier.DataSources.Picking.RandomItemSource RandomItemFrom(System.Collections.Generic.IList list) { } + public static TestStack.Dossier.DataSources.Picking.RepeatingSequenceSource RepeatingSequenceFrom(System.Collections.Generic.IList list) { } + } + public class RandomItemSource : TestStack.Dossier.DataSources.DataSource + + { + public RandomItemSource(System.Collections.Generic.IList list) { } + protected override System.Collections.Generic.IList InitializeDataSource() { } + } + public class RepeatingSequenceSource : TestStack.Dossier.DataSources.DataSource + + { + public RepeatingSequenceSource(System.Collections.Generic.IList list) { } + protected override System.Collections.Generic.IList InitializeDataSource() { } + } +} +namespace TestStack.Dossier.EquivalenceClasses +{ + + public class static EnumEquivalenceClasses + { + public static TEnum Except(this TestStack.Dossier.AnonymousValueFixture fixture, params TEnum[] except) + where TEnum : struct, System.IComparable, System.IFormattable, System.IConvertible { } + public static TEnum Of(this TestStack.Dossier.AnonymousValueFixture fixture) + where TEnum : struct, System.IComparable, System.IFormattable, System.IConvertible { } + } + public class static IntegerEquivalenceClasses + { + public static int IntegerExcept(this TestStack.Dossier.AnonymousValueFixture fixture, params int[] exceptFor) { } + public static int NegativeInteger(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static int PositiveInteger(this TestStack.Dossier.AnonymousValueFixture fixture) { } + } + public class static StringEquivalenceClasses + { + public static string String(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string StringEndingWith(this TestStack.Dossier.AnonymousValueFixture fixture, string suffix) { } + public static string StringMatching(this TestStack.Dossier.AnonymousValueFixture fixture, string regexPattern) { } + public static string StringOfLength(this TestStack.Dossier.AnonymousValueFixture fixture, int length) { } + public static string StringStartingWith(this TestStack.Dossier.AnonymousValueFixture fixture, string prefix) { } + } +} +namespace TestStack.Dossier.EquivalenceClasses.Geo +{ + + public class static GeographyEquivalenceClassescs + { + public static string Continent(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string Country(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string CountryCode(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string Latitude(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string Longitude(this TestStack.Dossier.AnonymousValueFixture fixture) { } + } +} +namespace TestStack.Dossier.EquivalenceClasses.Person +{ + + public class static NameEquivalenceClasses + { + public static string EmailAddress(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string FemaleFirstName(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string FirstName(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string FullName(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string Language(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string LastName(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string MaleFirstName(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string Suffix(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string Title(this TestStack.Dossier.AnonymousValueFixture fixture) { } + public static string UniqueEmailAddress(this TestStack.Dossier.AnonymousValueFixture fixture) { } + } +} +namespace TestStack.Dossier.Factories +{ + + public class AllPropertiesFactory : TestStack.Dossier.Factories.CallConstructorFactory + { + public AllPropertiesFactory() { } + public override TObject BuildObject(TestStack.Dossier.TestDataBuilder builder) + where TObject : class + where TBuilder : TestStack.Dossier.TestDataBuilder<, >, new () { } + } + public class AutoFixtureFactory : TestStack.Dossier.Factories.IFactory + { + public AutoFixtureFactory() { } + public TObject BuildObject(TestStack.Dossier.TestDataBuilder builder) + where TObject : class + where TBuilder : TestStack.Dossier.TestDataBuilder<, >, new () { } + } + public class CallConstructorFactory : TestStack.Dossier.Factories.IFactory + { + public CallConstructorFactory() { } + public virtual TObject BuildObject(TestStack.Dossier.TestDataBuilder builder) + where TObject : class + where TBuilder : TestStack.Dossier.TestDataBuilder<, >, new () { } + } + public interface IFactory + { + TObject BuildObject(TestStack.Dossier.TestDataBuilder builder) + where TObject : class + where TBuilder : TestStack.Dossier.TestDataBuilder<, >, new (); + } + public class PublicPropertySettersFactory : TestStack.Dossier.Factories.CallConstructorFactory + { + public PublicPropertySettersFactory() { } + public override TObject BuildObject(TestStack.Dossier.TestDataBuilder builder) + where TObject : class + where TBuilder : TestStack.Dossier.TestDataBuilder<, >, new () { } + } +} +namespace TestStack.Dossier.Lists +{ + + public class ListBuilder + where TObject : class + where TBuilder : TestStack.Dossier.TestDataBuilder<, >, new () + { + public TBuilder All() { } + public System.Collections.Generic.IList BuildList() { } + public TBuilder TheFirst(int howMany) { } + public TBuilder TheLast(int howMany) { } + public TBuilder TheNext(int howMany) { } + public TBuilder ThePrevious(int howMany) { } + public TestStack.Dossier.Lists.ListBuilder With(System.Func modifier) { } + } + public class static ListBuilderExtensions + { + public static TBuilder All(this TestStack.Dossier.TestDataBuilder builder) + where TObject : class + where TBuilder : TestStack.Dossier.TestDataBuilder<, >, new () { } + public static System.Collections.Generic.IList BuildList(this TestStack.Dossier.TestDataBuilder builder) + where TObject : class + where TBuilder : TestStack.Dossier.TestDataBuilder<, >, new () { } + public static TBuilder TheFirst(this TestStack.Dossier.TestDataBuilder builder, int howMany) + where TObject : class + where TBuilder : TestStack.Dossier.TestDataBuilder<, >, new () { } + public static TBuilder TheLast(this TestStack.Dossier.TestDataBuilder builder, int howMany) + where TObject : class + where TBuilder : TestStack.Dossier.TestDataBuilder<, >, new () { } + public static TBuilder TheNext(this TestStack.Dossier.TestDataBuilder builder, int howMany) + where TObject : class + where TBuilder : TestStack.Dossier.TestDataBuilder<, >, new () { } + public static TBuilder ThePrevious(this TestStack.Dossier.TestDataBuilder builder, int howMany) + where TObject : class + where TBuilder : TestStack.Dossier.TestDataBuilder<, >, new () { } + public static TestStack.Dossier.Lists.ListBuilder With(this TestStack.Dossier.TestDataBuilder builder, System.Func modifier) + where TObject : class + where TBuilder : TestStack.Dossier.TestDataBuilder<, >, new () { } + } +} +namespace TestStack.Dossier.Suppliers +{ + + public class DefaultEmailValueSupplier : TestStack.Dossier.IAnonymousValueSupplier + { + public DefaultEmailValueSupplier() { } + public bool CanSupplyValue(System.Type type, string propertyName) { } + public object GenerateAnonymousValue(TestStack.Dossier.AnonymousValueFixture any, System.Type type, string propertyName) { } + } + public class DefaultFirstNameValueSupplier : TestStack.Dossier.IAnonymousValueSupplier + { + public DefaultFirstNameValueSupplier() { } + public bool CanSupplyValue(System.Type type, string propertyName) { } + public object GenerateAnonymousValue(TestStack.Dossier.AnonymousValueFixture any, System.Type type, string propertyName) { } + } + public class DefaultLastNameValueSupplier : TestStack.Dossier.IAnonymousValueSupplier + { + public DefaultLastNameValueSupplier() { } + public bool CanSupplyValue(System.Type type, string propertyName) { } + public object GenerateAnonymousValue(TestStack.Dossier.AnonymousValueFixture any, System.Type type, string propertyName) { } + } + public class DefaultStringValueSupplier : TestStack.Dossier.IAnonymousValueSupplier + { + public DefaultStringValueSupplier() { } + public bool CanSupplyValue(System.Type type, string propertyName) { } + public object GenerateAnonymousValue(TestStack.Dossier.AnonymousValueFixture any, System.Type type, string propertyName) { } + } + public class DefaultValueSupplier : TestStack.Dossier.IAnonymousValueSupplier + { + public DefaultValueSupplier() { } + public bool CanSupplyValue(System.Type type, string propertyName) { } + public object GenerateAnonymousValue(TestStack.Dossier.AnonymousValueFixture any, System.Type type, string propertyName) { } + } + public class DefaultValueTypeValueSupplier : TestStack.Dossier.IAnonymousValueSupplier + { + public DefaultValueTypeValueSupplier() { } + public bool CanSupplyValue(System.Type type, string propertyName) { } + public object GenerateAnonymousValue(TestStack.Dossier.AnonymousValueFixture any, System.Type type, string propertyName) { } + } +} \ No newline at end of file diff --git a/TestStack.Dossier.Tests/PublicApiApproval/PublicApiApproverTests.cs b/TestStack.Dossier.Tests/PublicApiApproval/PublicApiApproverTests.cs new file mode 100644 index 0000000..bfc026b --- /dev/null +++ b/TestStack.Dossier.Tests/PublicApiApproval/PublicApiApproverTests.cs @@ -0,0 +1,17 @@ +using Shouldly; +using Xunit; + +namespace TestStack.Dossier.Tests.PublicApiApproval +{ + public class PublicApiApproverTests + { + [Fact] + public void GivenDossierAssembly_WhenPublicApiChecked_ShouldHaveNoChanges() + { + ShouldlyConfiguration.DiffTools.KnownDoNotLaunchStrategies.TeamCity.ShouldNotLaunch(); + var dossierAssembly = typeof (AnonymousValueFixture).Assembly; + var publicApi = PublicApiGenerator.PublicApiGenerator.GetPublicApi(dossierAssembly); + publicApi.ShouldMatchApproved(); + } + } +} diff --git a/TestStack.Dossier.Tests/TestStack.Dossier.Tests.csproj b/TestStack.Dossier.Tests/TestStack.Dossier.Tests.csproj index b9368a6..dec25d4 100644 --- a/TestStack.Dossier.Tests/TestStack.Dossier.Tests.csproj +++ b/TestStack.Dossier.Tests/TestStack.Dossier.Tests.csproj @@ -24,6 +24,7 @@ prompt 4 false + 5 pdbonly @@ -39,9 +40,13 @@ False ..\packages\NSubstitute.1.8.1.0\lib\net45\NSubstitute.dll - - False - ..\packages\Shouldly.2.4.0\lib\net40\Shouldly.dll + + ..\packages\PublicApiGenerator.4.0.1\lib\net40\PublicApiGenerator.dll + True + + + ..\packages\Shouldly.2.7.0-beta0003\lib\net40\Shouldly.dll + True @@ -58,6 +63,22 @@ + + + + + + + + + + + + + + + + @@ -72,15 +93,15 @@ - - - + + + - - + + diff --git a/TestStack.Dossier.Tests/packages.config b/TestStack.Dossier.Tests/packages.config index 47316f3..30cb97f 100644 --- a/TestStack.Dossier.Tests/packages.config +++ b/TestStack.Dossier.Tests/packages.config @@ -1,7 +1,8 @@  - + + \ No newline at end of file diff --git a/TestStack.Dossier/AnonymousValueFixture.cs b/TestStack.Dossier/AnonymousValueFixture.cs index 3558fd6..2fb2082 100644 --- a/TestStack.Dossier/AnonymousValueFixture.cs +++ b/TestStack.Dossier/AnonymousValueFixture.cs @@ -1,8 +1,11 @@ using System; +using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; +using System.Text; using Ploeh.AutoFixture; +using TestStack.Dossier.DataSources.Dictionaries; using TestStack.Dossier.Suppliers; namespace TestStack.Dossier @@ -106,5 +109,17 @@ public object Get(Type type, string propertyName) return valueSupplier.GenerateAnonymousValue(this, type, propertyName); } + + /// + /// Gets a data source for a file dictionary, which can be built-in or a user-supplied text file. + /// + /// The name of the file dictionary, without the extension. + /// Recommended to use the FromDictionary list of constants for the built-in file dictionaries. + /// Just use a normal string for user-supplied text files. + /// + public Words Words(string dictionaryName) + { + return WordsCache.Get(dictionaryName); + } } } diff --git a/TestStack.Dossier/DataSources/Dictionaries/Cache.cs b/TestStack.Dossier/DataSources/Dictionaries/Cache.cs deleted file mode 100644 index 1fd98b4..0000000 --- a/TestStack.Dossier/DataSources/Dictionaries/Cache.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Collections.Concurrent; -using System.Collections.Generic; - -namespace TestStack.Dossier.DataSources.Dictionaries -{ - internal static class Cache - { - private static ConcurrentDictionary> _cache = new ConcurrentDictionary>(); - - internal static IList Get(string dictionary) - { - return _cache.ContainsKey(dictionary) ? _cache[dictionary] : null; - } - - internal static void Set(string key, IList items) - { - _cache[key] = items; - } - - public static bool Contains(string key) - { - return _cache.ContainsKey(key); - } - - public static void Clear() - { - _cache = new ConcurrentDictionary>(); - } - } -} diff --git a/TestStack.Dossier/DataSources/Dictionaries/CachedFileDictionaryRepository.cs b/TestStack.Dossier/DataSources/Dictionaries/CachedFileDictionaryRepository.cs index 1743bfa..0a783d1 100644 --- a/TestStack.Dossier/DataSources/Dictionaries/CachedFileDictionaryRepository.cs +++ b/TestStack.Dossier/DataSources/Dictionaries/CachedFileDictionaryRepository.cs @@ -12,11 +12,6 @@ internal class CachedFileDictionaryRepository : IDictionaryRepository { public IList GetWordsFrom(string dictionary) { - if (Cache.Contains(dictionary)) - { - return Cache.Get(dictionary); - } - var words = new List(); var name = string.Format("{0}.txt", dictionary); @@ -30,7 +25,6 @@ public IList GetWordsFrom(string dictionary) words = GetWordsFromEmbeddedResource(GetType().Assembly, resourceName).ToList(); } - Cache.Set(dictionary, words); return words; } diff --git a/TestStack.Dossier/DataSources/Dictionaries/FileDictionarySource.cs b/TestStack.Dossier/DataSources/Dictionaries/FileDictionarySource.cs index e931f9f..cb3983b 100644 --- a/TestStack.Dossier/DataSources/Dictionaries/FileDictionarySource.cs +++ b/TestStack.Dossier/DataSources/Dictionaries/FileDictionarySource.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using TestStack.Dossier.DataSources.Generators; namespace TestStack.Dossier.DataSources.Dictionaries @@ -6,13 +7,15 @@ namespace TestStack.Dossier.DataSources.Dictionaries /// /// The base class for data sources that load their data from dictionaries stored in files /// + [Obsolete("FileDictionarySource is deprecated, please use Words(FromDictionary) instead.")] public abstract class FileDictionarySource : DataSource { private readonly IDictionaryRepository _repository; /// protected FileDictionarySource() - : this(new RandomGenerator(), new CachedFileDictionaryRepository()) { } + : this(new RandomGenerator(), new CachedFileDictionaryRepository()) + { } /// internal FileDictionarySource(IGenerator generator, IDictionaryRepository repository) diff --git a/TestStack.Dossier/DataSources/Dictionaries/FromDictionary.cs b/TestStack.Dossier/DataSources/Dictionaries/FromDictionary.cs new file mode 100644 index 0000000..ac4d958 --- /dev/null +++ b/TestStack.Dossier/DataSources/Dictionaries/FromDictionary.cs @@ -0,0 +1,75 @@ +#pragma warning disable 1591 +namespace TestStack.Dossier.DataSources.Dictionaries +{ + /// + /// Provides strongly-typed access to all of the built-in file dictionary names. + /// + public class FromDictionary + { + public const string AddressAusCity = "AddressAusCity"; + public const string AddressAusCompany = "AddressAusCompany"; + public const string AddressAusPhone = "AddressAusPhone"; + public const string AddressAusPostCode = "AddressAusPostCode"; + public const string AddressAusState = "AddressAusState"; + public const string AddressAusStateAbbreviation = "AddressAusStateAbbreviation"; + public const string AddressAusStreet = "AddressAusStreet"; + public const string AddressAusWebsite = "AddressAusWebsite"; + public const string AddressUkCity = "AddressUKCity"; + public const string AddressUkCompany = "AddressUKCompany"; + public const string AddressUkCounty = "AddressUKCounty"; + public const string AddressUkPhone = "AddressUKPhone"; + public const string AddressUkPostCode = "AddressUKPostCode"; + public const string AddressUkStreet = "AddressUKStreet"; + public const string AddressUkWebsite = "AddressUKWebsite"; + public const string AddressUsCity = "AddressUSCity"; + public const string AddressUsCompany = "AddressUSCompany"; + public const string AddressUsPhone = "AddressUSPhone"; + public const string AddressUsSocialSecurityNumber = "AddressUSSocialSecurityNumber"; + public const string AddressUsState = "AddressUSState"; + public const string AddressUsStateAbbreviation = "AddressUSStateAbbreviation"; + public const string AddressUsStreet = "AddressUSStreet"; + public const string AddressUsWebsite = "AddressUSWebsite"; + public const string AddressUsZipCode = "AddressUSZipCode"; + public const string ColourHex = "ColourHex"; + public const string ColourName = "ColourName"; + public const string CompanyIndustry = "CompanyIndustry"; + public const string CompanyJobTitle = "CompanyJobTitle"; + public const string CompanyLocation = "CompanyLocation"; + public const string CompanyName = "CompanyName"; + public const string FinanceCreditCardNumber = "FinanceCreditCardNumber"; + public const string FinanceCreditCardType = "FinanceCreditCardType"; + public const string FinanceCurrency = "FinanceCurrency"; + public const string FinanceCurrencyCode = "FinanceCurrencyCode"; + public const string Frequency = "Frequency"; + public const string GeoContinent = "GeoContinent"; + public const string GeoCountry = "GeoCountry"; + public const string GeoCountryCode = "GeoCountryCode"; + public const string GeoLatitude = "GeoLatitude"; + public const string GeoLongitude = "GeoLongitude"; + public const string IdentifierBitcoinAddress = "IdentifierBitcoinAddress"; + public const string IdentifierIban = "IdentifierIBAN"; + public const string IdentifierIpAddressV4 = "IdentifierIPAddressV4"; + public const string IdentifierIpAddressV6 = "IdentifierIPAddressV6"; + public const string IdentifierIsbn = "IdentifierISBN"; + public const string IdentifierMacAddress = "IdentifierMacAddress"; + public const string InternetDomainCountryCodeTopLevelDomain = "InternetDomainCountryCodeTopLevelDomain"; + public const string InternetDomainName = "InternetDomainName"; + public const string InternetDomainTopLevel = "InternetDomainTopLevel"; + public const string InternetUrl = "InternetURL"; + public const string LoremIpsum = "LoremIpsum"; + public const string PersonEmailAddress = "PersonEmailAddress"; + public const string PersonLanguage = "PersonLanguage"; + public const string PersonNameFirst = "PersonNameFirst"; + public const string PersonNameFirstFemale = "PersonNameFirstFemale"; + public const string PersonNameFirstMale = "PersonNameFirstMale"; + public const string PersonNameFull = "PersonNameFull"; + public const string PersonNameLast = "PersonNameLast"; + public const string PersonNameSuffix = "PersonNameSuffix"; + public const string PersonNameTitle = "PersonNameTitle"; + public const string PersonPassword = "PersonPassword"; + public const string PersonRace = "PersonRace"; + public const string PersonUsername = "PersonUsername"; + public const string ShirtSize = "ShirtSize"; + } +} +#pragma warning restore 1591 \ No newline at end of file diff --git a/TestStack.Dossier/DataSources/Dictionaries/Words.cs b/TestStack.Dossier/DataSources/Dictionaries/Words.cs new file mode 100644 index 0000000..f15705b --- /dev/null +++ b/TestStack.Dossier/DataSources/Dictionaries/Words.cs @@ -0,0 +1,36 @@ +using System.Collections.Generic; +using TestStack.Dossier.DataSources.Generators; + +namespace TestStack.Dossier.DataSources.Dictionaries +{ + /// + /// The wrapper class for data sources that load words from dictionaries stored in files + /// + public class Words : DataSource + { + private readonly string _dictionaryName; + private readonly IDictionaryRepository _repository; + + /// + public Words(string dictionaryName) + : this(new RandomGenerator(), new CachedFileDictionaryRepository(), dictionaryName) + { + } + + /// + internal Words(IGenerator generator, IDictionaryRepository repository, string dictionaryName) + : base(generator) + { + _repository = repository; + _dictionaryName = dictionaryName; + } + + internal string DictionaryName { get { return _dictionaryName; } } + + /// + protected override IList InitializeDataSource() + { + return _repository.GetWordsFrom(_dictionaryName); + } + } +} \ No newline at end of file diff --git a/TestStack.Dossier/DataSources/Dictionaries/WordsCache.cs b/TestStack.Dossier/DataSources/Dictionaries/WordsCache.cs new file mode 100644 index 0000000..fbcb96b --- /dev/null +++ b/TestStack.Dossier/DataSources/Dictionaries/WordsCache.cs @@ -0,0 +1,37 @@ +using System.Collections.Concurrent; + +namespace TestStack.Dossier.DataSources.Dictionaries +{ + /// + /// Just caches a file dictionary data source the first time it is accessed and returns the same instance + /// each subsequent request. The Words data source is then responsible for lazy loading its dictionary contents + /// the first time it is accessed. At that point an exception will be thrown if the dictionary does not exist. + /// + internal static class WordsCache + { + private static ConcurrentDictionary _cache = new ConcurrentDictionary(); + + /// + /// Gets the Words in the file with the specified dictionary name. + /// This method is used by . + /// + /// Name of the dictionary file. + /// + internal static Words Get(string dictionaryName) + { + if (!_cache.ContainsKey(dictionaryName)) + { + _cache[dictionaryName] = new Words(dictionaryName); + } + return _cache[dictionaryName]; + } + + /// + /// Just exposed for testing purposes. + /// + internal static void Clear() + { + _cache = new ConcurrentDictionary(); + } + } +} diff --git a/TestStack.Dossier/DataSources/Geography/GeoContinentSource.cs b/TestStack.Dossier/DataSources/Geography/GeoContinentSource.cs index 7f0b525..b535f0a 100644 --- a/TestStack.Dossier/DataSources/Geography/GeoContinentSource.cs +++ b/TestStack.Dossier/DataSources/Geography/GeoContinentSource.cs @@ -1,10 +1,12 @@ -using TestStack.Dossier.DataSources.Dictionaries; +using System; +using TestStack.Dossier.DataSources.Dictionaries; namespace TestStack.Dossier.DataSources.Geography { /// /// Dictionary of continent names /// + [Obsolete("GeoContinentSource is deprecated, please use Words(FromDictionary.GeoContinent) instead.")] public class GeoContinentSource : FileDictionarySource { } diff --git a/TestStack.Dossier/DataSources/Geography/GeoCountryCodeSource.cs b/TestStack.Dossier/DataSources/Geography/GeoCountryCodeSource.cs index 4e398b0..514748d 100644 --- a/TestStack.Dossier/DataSources/Geography/GeoCountryCodeSource.cs +++ b/TestStack.Dossier/DataSources/Geography/GeoCountryCodeSource.cs @@ -1,10 +1,12 @@ -using TestStack.Dossier.DataSources.Dictionaries; +using System; +using TestStack.Dossier.DataSources.Dictionaries; namespace TestStack.Dossier.DataSources.Geography { /// /// Dictionary of country codes /// + [Obsolete("GeoCountryCodeSource is deprecated, please use Words(FromDictionary.GeoCountryCode) instead.")] public class GeoCountryCodeSource : FileDictionarySource { } diff --git a/TestStack.Dossier/DataSources/Geography/GeoCountrySource.cs b/TestStack.Dossier/DataSources/Geography/GeoCountrySource.cs index 0f9c3e0..a598c8e 100644 --- a/TestStack.Dossier/DataSources/Geography/GeoCountrySource.cs +++ b/TestStack.Dossier/DataSources/Geography/GeoCountrySource.cs @@ -1,10 +1,12 @@ -using TestStack.Dossier.DataSources.Dictionaries; +using System; +using TestStack.Dossier.DataSources.Dictionaries; namespace TestStack.Dossier.DataSources.Geography { /// /// Dictionary of country names /// + [Obsolete("GeoCountrySource is deprecated, please use Words(FromDictionary.GeoCountry) instead.")] public class GeoCountrySource : FileDictionarySource { } diff --git a/TestStack.Dossier/DataSources/Geography/GeoLatitudeSource.cs b/TestStack.Dossier/DataSources/Geography/GeoLatitudeSource.cs index f692bfb..1a12723 100644 --- a/TestStack.Dossier/DataSources/Geography/GeoLatitudeSource.cs +++ b/TestStack.Dossier/DataSources/Geography/GeoLatitudeSource.cs @@ -1,10 +1,12 @@ -using TestStack.Dossier.DataSources.Dictionaries; +using System; +using TestStack.Dossier.DataSources.Dictionaries; namespace TestStack.Dossier.DataSources.Geography { /// /// Dictionary of latitude coordinates /// + [Obsolete("GeoLatitudeSource is deprecated, please use Words(FromDictionary.GeoLatitude) instead.")] public class GeoLatitudeSource : FileDictionarySource { } diff --git a/TestStack.Dossier/DataSources/Geography/GeoLongitudeSource.cs b/TestStack.Dossier/DataSources/Geography/GeoLongitudeSource.cs index 1396c24..10d5aef 100644 --- a/TestStack.Dossier/DataSources/Geography/GeoLongitudeSource.cs +++ b/TestStack.Dossier/DataSources/Geography/GeoLongitudeSource.cs @@ -1,10 +1,12 @@ -using TestStack.Dossier.DataSources.Dictionaries; +using System; +using TestStack.Dossier.DataSources.Dictionaries; namespace TestStack.Dossier.DataSources.Geography { /// /// Dictionary of longitude coordinates codes /// + [Obsolete("GeoLongitudeSource is deprecated, please use Words(FromDictionary.GeoLongitude) instead.")] public class GeoLongitudeSource : FileDictionarySource { } diff --git a/TestStack.Dossier/DataSources/Person/PersonEmailAddressSource.cs b/TestStack.Dossier/DataSources/Person/PersonEmailAddressSource.cs index 5f0645d..19f2d1f 100644 --- a/TestStack.Dossier/DataSources/Person/PersonEmailAddressSource.cs +++ b/TestStack.Dossier/DataSources/Person/PersonEmailAddressSource.cs @@ -1,3 +1,4 @@ +using System; using TestStack.Dossier.DataSources.Dictionaries; using TestStack.Dossier.DataSources.Generators; @@ -6,6 +7,7 @@ namespace TestStack.Dossier.DataSources.Person /// /// Dictionary of email addresses names /// + [Obsolete("PersonEmailAddressSource is deprecated, please use Words(FromDictionary.PersonEmailAddress) instead.")] public class PersonEmailAddressSource : FileDictionarySource { /// diff --git a/TestStack.Dossier/DataSources/Person/PersonLanguageSource.cs b/TestStack.Dossier/DataSources/Person/PersonLanguageSource.cs index 74ac97b..39f5358 100644 --- a/TestStack.Dossier/DataSources/Person/PersonLanguageSource.cs +++ b/TestStack.Dossier/DataSources/Person/PersonLanguageSource.cs @@ -1,10 +1,12 @@ -using TestStack.Dossier.DataSources.Dictionaries; +using System; +using TestStack.Dossier.DataSources.Dictionaries; namespace TestStack.Dossier.DataSources.Person { /// /// Dictionary of language names /// + [Obsolete("PersonLanguageSource is deprecated, please use Words(FromDictionary.PersonLanguage) instead.")] public class PersonLanguageSource : FileDictionarySource { } diff --git a/TestStack.Dossier/DataSources/Person/PersonNameFirstFemaleSource.cs b/TestStack.Dossier/DataSources/Person/PersonNameFirstFemaleSource.cs index 866ff15..6f8dbb8 100644 --- a/TestStack.Dossier/DataSources/Person/PersonNameFirstFemaleSource.cs +++ b/TestStack.Dossier/DataSources/Person/PersonNameFirstFemaleSource.cs @@ -1,3 +1,4 @@ +using System; using TestStack.Dossier.DataSources.Dictionaries; namespace TestStack.Dossier.DataSources.Person @@ -5,6 +6,7 @@ namespace TestStack.Dossier.DataSources.Person /// /// Dictionary of female first names /// + [Obsolete("PersonNameFirstFemaleSource is deprecated, please use Words(FromDictionary.PersonNameFirstFemale) instead.")] public class PersonNameFirstFemaleSource : FileDictionarySource { } diff --git a/TestStack.Dossier/DataSources/Person/PersonNameFirstMaleSource.cs b/TestStack.Dossier/DataSources/Person/PersonNameFirstMaleSource.cs index fa33c33..982fa02 100644 --- a/TestStack.Dossier/DataSources/Person/PersonNameFirstMaleSource.cs +++ b/TestStack.Dossier/DataSources/Person/PersonNameFirstMaleSource.cs @@ -1,3 +1,4 @@ +using System; using TestStack.Dossier.DataSources.Dictionaries; namespace TestStack.Dossier.DataSources.Person @@ -5,6 +6,7 @@ namespace TestStack.Dossier.DataSources.Person /// /// Dictionary of male first names /// + [Obsolete("PersonNameFirstMaleSource is deprecated, please use Words(FromDictionary.PersonNameFirstMale) instead.")] public class PersonNameFirstMaleSource : FileDictionarySource { } diff --git a/TestStack.Dossier/DataSources/Person/PersonNameFirstSource.cs b/TestStack.Dossier/DataSources/Person/PersonNameFirstSource.cs index c913cbd..776cd9a 100644 --- a/TestStack.Dossier/DataSources/Person/PersonNameFirstSource.cs +++ b/TestStack.Dossier/DataSources/Person/PersonNameFirstSource.cs @@ -1,10 +1,12 @@ -using TestStack.Dossier.DataSources.Dictionaries; +using System; +using TestStack.Dossier.DataSources.Dictionaries; namespace TestStack.Dossier.DataSources.Person { /// /// Dictionary of male and female first names /// + [Obsolete("PersonNameFirstSource is deprecated, please use Words(FromDictionary.PersonNameFirst) instead.")] public class PersonNameFirstSource : FileDictionarySource { } diff --git a/TestStack.Dossier/DataSources/Person/PersonNameFullSource.cs b/TestStack.Dossier/DataSources/Person/PersonNameFullSource.cs index a94c348..abf7c78 100644 --- a/TestStack.Dossier/DataSources/Person/PersonNameFullSource.cs +++ b/TestStack.Dossier/DataSources/Person/PersonNameFullSource.cs @@ -1,3 +1,4 @@ +using System; using TestStack.Dossier.DataSources.Dictionaries; namespace TestStack.Dossier.DataSources.Person @@ -5,6 +6,7 @@ namespace TestStack.Dossier.DataSources.Person /// /// Dictionary of male and female full names - first and last name /// + [Obsolete("PersonNameFullSource is deprecated, please use Words(FromDictionary.PersonNameFull) instead.")] public class PersonNameFullSource : FileDictionarySource { } diff --git a/TestStack.Dossier/DataSources/Person/PersonNameLastSource.cs b/TestStack.Dossier/DataSources/Person/PersonNameLastSource.cs index 286557d..f016ef1 100644 --- a/TestStack.Dossier/DataSources/Person/PersonNameLastSource.cs +++ b/TestStack.Dossier/DataSources/Person/PersonNameLastSource.cs @@ -1,3 +1,4 @@ +using System; using TestStack.Dossier.DataSources.Dictionaries; namespace TestStack.Dossier.DataSources.Person @@ -5,6 +6,7 @@ namespace TestStack.Dossier.DataSources.Person /// /// Dictionary of last names /// + [Obsolete("PersonNameLastSource is deprecated, please use Words(FromDictionary.PersonNameLast) instead.")] public class PersonNameLastSource : FileDictionarySource { } diff --git a/TestStack.Dossier/DataSources/Person/PersonNameSuffixSource.cs b/TestStack.Dossier/DataSources/Person/PersonNameSuffixSource.cs index cab816a..46bf6bd 100644 --- a/TestStack.Dossier/DataSources/Person/PersonNameSuffixSource.cs +++ b/TestStack.Dossier/DataSources/Person/PersonNameSuffixSource.cs @@ -1,3 +1,4 @@ +using System; using TestStack.Dossier.DataSources.Dictionaries; namespace TestStack.Dossier.DataSources.Person @@ -5,6 +6,7 @@ namespace TestStack.Dossier.DataSources.Person /// /// Dictionary of name suffixes /// + [Obsolete("PersonNameSuffixSource is deprecated, please use Words(FromDictionary.PersonNameSuffix) instead.")] public class PersonNameSuffixSource : FileDictionarySource { } diff --git a/TestStack.Dossier/DataSources/Person/PersonNameTitleSource.cs b/TestStack.Dossier/DataSources/Person/PersonNameTitleSource.cs index d69a6b8..b2b04bb 100644 --- a/TestStack.Dossier/DataSources/Person/PersonNameTitleSource.cs +++ b/TestStack.Dossier/DataSources/Person/PersonNameTitleSource.cs @@ -1,3 +1,4 @@ +using System; using TestStack.Dossier.DataSources.Dictionaries; namespace TestStack.Dossier.DataSources.Person @@ -5,6 +6,7 @@ namespace TestStack.Dossier.DataSources.Person /// /// Dictionary of name titles /// + [Obsolete("PersonNameTitleSource is deprecated, please use Words(FromDictionary.PersonNameTitle) instead.")] public class PersonNameTitleSource : FileDictionarySource { } diff --git a/TestStack.Dossier/EquivalenceClasses/AddressAusEquivalence.cs b/TestStack.Dossier/EquivalenceClasses/AddressAusEquivalence.cs new file mode 100644 index 0000000..048013d --- /dev/null +++ b/TestStack.Dossier/EquivalenceClasses/AddressAusEquivalence.cs @@ -0,0 +1,92 @@ +using TestStack.Dossier.DataSources.Dictionaries; + +// ReSharper disable once CheckNamespace +namespace TestStack.Dossier +{ + /// + /// Extension methods that describe equivalence classes for generating anonymous Australian address-related values. + /// + public static class AddressAusEquivalence + { + /// + /// Generate and return an Australian address city name. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string AddressAusCity(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.AddressAusCity).Next(); + } + + /// + /// Generate and return an Australian address company name. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string AddressAusCompany(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.AddressAusCompany).Next(); + } + + /// + /// Generate and return an Australian address phone number. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string AddressAusPhone(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.AddressAusPhone).Next(); + } + + /// + /// Generate and return an Australian address post code. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string AddressAusPostCode(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.AddressAusPostCode).Next(); + } + + /// + /// Generate and return an Australian address state name. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string AddressAusState(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.AddressAusState).Next(); + } + + /// + /// Generate and return an Australian address state abbreviation. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string AddressAusStateAbbreviation(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.AddressAusStateAbbreviation).Next(); + } + + /// + /// Generate and return an Australian address street name. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string AddressAusStreet(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.AddressAusStreet).Next(); + } + + /// + /// Generate and return an Australian address website name. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string AddressAusWebsite(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.AddressAusWebsite).Next(); + } + + } +} \ No newline at end of file diff --git a/TestStack.Dossier/EquivalenceClasses/AddressUkEquivalence.cs b/TestStack.Dossier/EquivalenceClasses/AddressUkEquivalence.cs new file mode 100644 index 0000000..8c3bdea --- /dev/null +++ b/TestStack.Dossier/EquivalenceClasses/AddressUkEquivalence.cs @@ -0,0 +1,82 @@ +using TestStack.Dossier.DataSources.Dictionaries; + +// ReSharper disable once CheckNamespace +namespace TestStack.Dossier +{ + /// + /// Extension methods that describe equivalence classes for generating anonymous UK address-related values. + /// + public static class AddressUkEquivalence + { + /// + /// Generate and return a UK address city name. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string AddressUkCity(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.AddressUkCity).Next(); + } + + /// + /// Generate and return a UK address company name. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string AddressUkCompany(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.AddressUkCompany).Next(); + } + + /// + /// Generate and return a UK address county name. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string AddressUkCounty(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.AddressUkCounty).Next(); + } + + /// + /// Generate and return a UK address phone number. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string AddressUkPhone(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.AddressUkPhone).Next(); + } + + /// + /// Generate and return a UK address post code. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string AddressUkPostCode(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.AddressUkPostCode).Next(); + } + + /// + /// Generate and return a UK address street name. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string AddressUkStreet(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.AddressUkStreet).Next(); + } + + /// + /// Generate and return a UK address website name. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string AddressUkWebsite(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.AddressUkWebsite).Next(); + } + + } +} \ No newline at end of file diff --git a/TestStack.Dossier/EquivalenceClasses/AddressUsEquivalence.cs b/TestStack.Dossier/EquivalenceClasses/AddressUsEquivalence.cs new file mode 100644 index 0000000..21feb59 --- /dev/null +++ b/TestStack.Dossier/EquivalenceClasses/AddressUsEquivalence.cs @@ -0,0 +1,101 @@ +using TestStack.Dossier.DataSources.Dictionaries; + +// ReSharper disable once CheckNamespace +namespace TestStack.Dossier +{ + /// + /// Extension methods that describe equivalence classes for generating anonymous US adress-related values. + /// + public static class AddressUsEquivalence + { + /// + /// Generate and return a US address city name. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string AddressUsCity(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.AddressUsCity).Next(); + } + + /// + /// Generate and return a US address company name. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string AddressUsCompany(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.AddressUsCompany).Next(); + } + + /// + /// Generate and return a US address phone number. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string AddressUsPhone(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.AddressUsPhone).Next(); + } + + /// + /// Generate and return a US address social security number. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string AddressUsSocialSecurityNumber(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.AddressUsSocialSecurityNumber).Next(); + } + + /// + /// Generate and return a US address state name. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string AddressUsState(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.AddressUsState).Next(); + } + + /// + /// Generate and return a US address state abbreviation. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string AddressUsStateAbbreviation(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.AddressUsStateAbbreviation).Next(); + } + + /// + /// Generate and return a US address street name. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string AddressUsStreet(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.AddressUsStreet).Next(); + } + + /// + /// Generate and return a US address website name. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string AddressUsWebsite(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.AddressUsWebsite).Next(); + } + + /// + /// Generate and return a US address zip code. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string AddressUsZipCode(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.AddressUsZipCode).Next(); + } + } +} \ No newline at end of file diff --git a/TestStack.Dossier/EquivalenceClasses/ColourEquivalence.cs b/TestStack.Dossier/EquivalenceClasses/ColourEquivalence.cs new file mode 100644 index 0000000..933481c --- /dev/null +++ b/TestStack.Dossier/EquivalenceClasses/ColourEquivalence.cs @@ -0,0 +1,31 @@ +using TestStack.Dossier.DataSources.Dictionaries; + +// ReSharper disable once CheckNamespace +namespace TestStack.Dossier +{ + /// + /// Extension methods that describe equivalence classes for generating anonymous Colour-related values. + /// + public static class ColourEquivalence + { + /// + /// Generate and return a Colour Hex value. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string ColourHex(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.ColourHex).Next(); + } + + /// + /// Generate and return a Colour name. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string ColourName(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.ColourName).Next(); + } + } +} \ No newline at end of file diff --git a/TestStack.Dossier/EquivalenceClasses/CompanyEquivalence.cs b/TestStack.Dossier/EquivalenceClasses/CompanyEquivalence.cs new file mode 100644 index 0000000..9038cc9 --- /dev/null +++ b/TestStack.Dossier/EquivalenceClasses/CompanyEquivalence.cs @@ -0,0 +1,52 @@ +using TestStack.Dossier.DataSources.Dictionaries; + +// ReSharper disable once CheckNamespace +namespace TestStack.Dossier +{ + /// + /// Extension methods that describe equivalence classes for generating anonymous Company-related values. + /// + public static class CompanyEquivalence + { + /// + /// Generate and return a company industry name. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string CompanyIndustry(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.CompanyIndustry).Next(); + } + + /// + /// Generate and return a company job title. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string CompanyJobTitle(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.CompanyJobTitle).Next(); + } + + /// + /// Generate and return a company location name. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string CompanyLocation(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.CompanyLocation).Next(); + } + + /// + /// Generate and return a company name. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string CompanyName(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.CompanyName).Next(); + } + + } +} \ No newline at end of file diff --git a/TestStack.Dossier/EquivalenceClasses/FinanceEquivalence.cs b/TestStack.Dossier/EquivalenceClasses/FinanceEquivalence.cs new file mode 100644 index 0000000..954f88c --- /dev/null +++ b/TestStack.Dossier/EquivalenceClasses/FinanceEquivalence.cs @@ -0,0 +1,52 @@ +using TestStack.Dossier.DataSources.Dictionaries; + +// ReSharper disable once CheckNamespace +namespace TestStack.Dossier +{ + /// + /// Extension methods that describe equivalence classes for generating anonymous Finance-related values. + /// + public static class FinanceEquivalence + { + /// + /// Generate and return a finance credit card number. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string FinanceCreditCardNumber(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.FinanceCreditCardNumber).Next(); + } + + /// + /// Generate and return a finance credit card type. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string FinanceCreditCardType(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.FinanceCreditCardType).Next(); + } + + /// + /// Generate and return a finance currency name. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string FinanceCurrency(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.FinanceCurrency).Next(); + } + + /// + /// Generate and return a finance currency code. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string FinanceCurrencyCode(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.FinanceCurrencyCode).Next(); + } + + } +} \ No newline at end of file diff --git a/TestStack.Dossier/EquivalenceClasses/FrequencyEquivalence.cs b/TestStack.Dossier/EquivalenceClasses/FrequencyEquivalence.cs new file mode 100644 index 0000000..c4c58cd --- /dev/null +++ b/TestStack.Dossier/EquivalenceClasses/FrequencyEquivalence.cs @@ -0,0 +1,22 @@ +using TestStack.Dossier.DataSources.Dictionaries; + +// ReSharper disable once CheckNamespace +namespace TestStack.Dossier +{ + /// + /// Extension methods that describe equivalence classes for generating anonymous Frequency-related values. + /// + public static class FrequencyEquivalence + { + /// + /// Generate and return a frequency. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string Frequency(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.Frequency).Next(); + } + + } +} \ No newline at end of file diff --git a/TestStack.Dossier/EquivalenceClasses/Geo/GeographyEquivalenceClassescs.cs b/TestStack.Dossier/EquivalenceClasses/Geo/GeographyEquivalenceClassescs.cs index c8c4377..9fbdf6c 100644 --- a/TestStack.Dossier/EquivalenceClasses/Geo/GeographyEquivalenceClassescs.cs +++ b/TestStack.Dossier/EquivalenceClasses/Geo/GeographyEquivalenceClassescs.cs @@ -1,18 +1,10 @@ -using TestStack.Dossier.DataSources.Geography; - -namespace TestStack.Dossier.EquivalenceClasses.Geo +namespace TestStack.Dossier.EquivalenceClasses.Geo { /// /// Extension methods that describe equivalence classes for generating anonymous geography-related values. /// public static class GeographyEquivalenceClassescs { - private static GeoContinentSource _geoContinentSource; - private static GeoCountrySource _geoCountrySource; - private static GeoCountryCodeSource _geoCountryCodeSource; - private static GeoLatitudeSource _geoLatitudeSource; - private static GeoLongitudeSource _geoLongitudeSource; - /// /// Generate and return a continent name. /// @@ -20,8 +12,7 @@ public static class GeographyEquivalenceClassescs /// The generated continent public static string Continent(this AnonymousValueFixture fixture) { - if (_geoContinentSource == null) _geoContinentSource = new GeoContinentSource(); - return _geoContinentSource.Next(); + return fixture.GeoContinent(); } /// @@ -31,8 +22,7 @@ public static string Continent(this AnonymousValueFixture fixture) /// The generated country public static string Country(this AnonymousValueFixture fixture) { - if (_geoCountrySource == null) _geoCountrySource = new GeoCountrySource(); - return _geoCountrySource.Next(); + return fixture.GeoCountry(); } /// @@ -42,8 +32,7 @@ public static string Country(this AnonymousValueFixture fixture) /// The generated country code public static string CountryCode(this AnonymousValueFixture fixture) { - if (_geoCountryCodeSource == null) _geoCountryCodeSource = new GeoCountryCodeSource(); - return _geoCountryCodeSource.Next(); + return fixture.GeoCountryCode(); } @@ -54,8 +43,7 @@ public static string CountryCode(this AnonymousValueFixture fixture) /// The generated latitude public static string Latitude(this AnonymousValueFixture fixture) { - if (_geoLatitudeSource == null) _geoLatitudeSource = new GeoLatitudeSource(); - return _geoLatitudeSource.Next(); + return fixture.GeoLatitude(); } /// @@ -65,8 +53,7 @@ public static string Latitude(this AnonymousValueFixture fixture) /// The generated longitude public static string Longitude(this AnonymousValueFixture fixture) { - if (_geoLongitudeSource == null) _geoLongitudeSource = new GeoLongitudeSource(); - return _geoLongitudeSource.Next(); + return fixture.GeoLongitude(); } } } diff --git a/TestStack.Dossier/EquivalenceClasses/GeoEquivalence.cs b/TestStack.Dossier/EquivalenceClasses/GeoEquivalence.cs new file mode 100644 index 0000000..2b513ac --- /dev/null +++ b/TestStack.Dossier/EquivalenceClasses/GeoEquivalence.cs @@ -0,0 +1,62 @@ +using TestStack.Dossier.DataSources.Dictionaries; + +// ReSharper disable once CheckNamespace +namespace TestStack.Dossier +{ + /// + /// Extension methods that describe equivalence classes for generating anonymous Geography-related values. + /// + public static class GeoEquivalence + { + /// + /// Generate and return a geography continent name. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string GeoContinent(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.GeoContinent).Next(); + } + + /// + /// Generate and return a geography country name. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string GeoCountry(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.GeoCountry).Next(); + } + + /// + /// Generate and return a geography country code. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string GeoCountryCode(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.GeoCountryCode).Next(); + } + + /// + /// Generate and return a geography latitude. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string GeoLatitude(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.GeoLatitude).Next(); + } + + /// + /// Generate and return a geography longitude. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string GeoLongitude(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.GeoLongitude).Next(); + } + + } +} \ No newline at end of file diff --git a/TestStack.Dossier/EquivalenceClasses/IdentifierEquivalence.cs b/TestStack.Dossier/EquivalenceClasses/IdentifierEquivalence.cs new file mode 100644 index 0000000..80cbad6 --- /dev/null +++ b/TestStack.Dossier/EquivalenceClasses/IdentifierEquivalence.cs @@ -0,0 +1,71 @@ +using TestStack.Dossier.DataSources.Dictionaries; + +// ReSharper disable once CheckNamespace +namespace TestStack.Dossier +{ + /// + /// Extension methods that describe equivalence classes for generating anonymous Identifier-related values. + /// + public static class IdentifierEquivalence + { + /// + /// Generate and return an identifier bitcoing address. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string IdentifierBitcoinAddress(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.IdentifierBitcoinAddress).Next(); + } + + /// + /// Generate and return an identifier IBAN. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string IdentifierIban(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.IdentifierIban).Next(); + } + + /// + /// Generate and return an identifier IP address v4. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string IdentifierIpAddressV4(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.IdentifierIpAddressV4).Next(); + } + + /// + /// Generate and return an identifier IP address v6. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string IdentifierIpAddressV6(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.IdentifierIpAddressV6).Next(); + } + + /// + /// Generate and return an identifier ISBN. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string IdentifierIsbn(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.IdentifierIsbn).Next(); + } + + /// + /// Generate and return an identifier MAC address. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string IdentifierMacAddress(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.IdentifierMacAddress).Next(); + } + } +} \ No newline at end of file diff --git a/TestStack.Dossier/EquivalenceClasses/InternetEquivalence.cs b/TestStack.Dossier/EquivalenceClasses/InternetEquivalence.cs new file mode 100644 index 0000000..b966182 --- /dev/null +++ b/TestStack.Dossier/EquivalenceClasses/InternetEquivalence.cs @@ -0,0 +1,52 @@ +using TestStack.Dossier.DataSources.Dictionaries; + +// ReSharper disable once CheckNamespace +namespace TestStack.Dossier +{ + /// + /// Extension methods that describe equivalence classes for generating anonymous Internet-related values. + /// + public static class InternetEquivalence + { + /// + /// Generate and return an internet domain country code top level domain. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string InternetDomainCountryCodeTopLevelDomain(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.InternetDomainCountryCodeTopLevelDomain).Next(); + } + + /// + /// Generate and return an internet domain name. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string InternetDomainName(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.InternetDomainName).Next(); + } + + /// + /// Generate and return a an internet domain top level name. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string InternetDomainTopLevel(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.InternetDomainTopLevel).Next(); + } + + /// + /// Generate and return an internet URL. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string InternetUrl(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.InternetUrl).Next(); + } + + } +} \ No newline at end of file diff --git a/TestStack.Dossier/EquivalenceClasses/LoremIpsumEquivalence.cs b/TestStack.Dossier/EquivalenceClasses/LoremIpsumEquivalence.cs new file mode 100644 index 0000000..9c5f61d --- /dev/null +++ b/TestStack.Dossier/EquivalenceClasses/LoremIpsumEquivalence.cs @@ -0,0 +1,22 @@ +using TestStack.Dossier.DataSources.Dictionaries; + +// ReSharper disable once CheckNamespace +namespace TestStack.Dossier +{ + /// + /// Extension methods that describe equivalence classes for generating anonymous Lorem Ipsum values. + /// + public static class LoremIpsumEquivalence + { + /// + /// Generate and return a lorem ipsum value. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string LoremIpsum(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.LoremIpsum).Next(); + } + + } +} \ No newline at end of file diff --git a/TestStack.Dossier/EquivalenceClasses/Person/PersonEquivalenceClasses.cs b/TestStack.Dossier/EquivalenceClasses/Person/PersonEquivalenceClasses.cs index d2f30b7..9d6f05b 100644 --- a/TestStack.Dossier/EquivalenceClasses/Person/PersonEquivalenceClasses.cs +++ b/TestStack.Dossier/EquivalenceClasses/Person/PersonEquivalenceClasses.cs @@ -1,24 +1,10 @@ -using TestStack.Dossier.DataSources.Generators; -using TestStack.Dossier.DataSources.Person; - -namespace TestStack.Dossier.EquivalenceClasses.Person +namespace TestStack.Dossier.EquivalenceClasses.Person { /// /// Extension methods that describe equivalence classes for generating anonymous person-related values. /// public static class NameEquivalenceClasses { - private static PersonEmailAddressSource _personEmailAddressSource; - private static PersonEmailAddressSource _uniquePersonEmailAddressSource; - private static PersonLanguageSource _personLanguageSource; - private static PersonNameFirstFemaleSource _personNameFirstFemaleSource; - private static PersonNameFirstSource _personNameFirstSource; - private static PersonNameFullSource _personNameFullSource; - private static PersonNameLastSource _personNameLastSource; - private static PersonNameFirstMaleSource _personNameFirstMaleSource; - private static PersonNameSuffixSource _personNameSuffixSource; - private static PersonNameTitleSource _personNameTitleSource; - /// /// Generate and return an email address. /// @@ -26,8 +12,7 @@ public static class NameEquivalenceClasses /// The generated email public static string EmailAddress(this AnonymousValueFixture fixture) { - if (_personEmailAddressSource == null) _personEmailAddressSource = new PersonEmailAddressSource(); - return _personEmailAddressSource.Next(); + return fixture.PersonEmailAddress(); } /// @@ -37,14 +22,7 @@ public static string EmailAddress(this AnonymousValueFixture fixture) /// The generated unique email public static string UniqueEmailAddress(this AnonymousValueFixture fixture) { - if (_uniquePersonEmailAddressSource == null) - { - if (_personEmailAddressSource == null) _personEmailAddressSource = new PersonEmailAddressSource(); - var generator = new SequentialGenerator(0, _personEmailAddressSource.Data.Count, listShouldBeUnique: true); - _uniquePersonEmailAddressSource = new PersonEmailAddressSource(generator); - } - - return _uniquePersonEmailAddressSource.Next(); + return fixture.PersonUniqueEmailAddress(); } /// @@ -54,8 +32,7 @@ public static string UniqueEmailAddress(this AnonymousValueFixture fixture) /// The generated language public static string Language(this AnonymousValueFixture fixture) { - if (_personLanguageSource == null) _personLanguageSource = new PersonLanguageSource(); - return _personLanguageSource.Next(); + return fixture.PersonLanguage(); } /// @@ -65,8 +42,7 @@ public static string Language(this AnonymousValueFixture fixture) /// The generated female first name public static string FemaleFirstName(this AnonymousValueFixture fixture) { - if (_personNameFirstFemaleSource == null) _personNameFirstFemaleSource = new PersonNameFirstFemaleSource(); - return _personNameFirstFemaleSource.Next(); + return fixture.PersonNameFirstFemale(); } /// @@ -76,8 +52,7 @@ public static string FemaleFirstName(this AnonymousValueFixture fixture) /// The generated first name public static string FirstName(this AnonymousValueFixture fixture) { - if (_personNameFirstSource == null) _personNameFirstSource = new PersonNameFirstSource(); - return _personNameFirstSource.Next(); + return fixture.PersonNameFirst(); } /// @@ -87,8 +62,7 @@ public static string FirstName(this AnonymousValueFixture fixture) /// The generated full name public static string FullName(this AnonymousValueFixture fixture) { - if (_personNameFullSource == null) _personNameFullSource = new PersonNameFullSource(); - return _personNameFullSource.Next(); + return fixture.PersonNameFull(); } /// @@ -98,8 +72,7 @@ public static string FullName(this AnonymousValueFixture fixture) /// The generated last name public static string LastName(this AnonymousValueFixture fixture) { - if (_personNameLastSource == null) _personNameLastSource = new PersonNameLastSource(); - return _personNameLastSource.Next(); + return fixture.PersonNameLast(); } /// @@ -109,8 +82,7 @@ public static string LastName(this AnonymousValueFixture fixture) /// The generated male first name public static string MaleFirstName(this AnonymousValueFixture fixture) { - if (_personNameFirstMaleSource == null) _personNameFirstMaleSource = new PersonNameFirstMaleSource(); - return _personNameFirstMaleSource.Next(); + return fixture.PersonNameFirstMale(); } /// @@ -120,8 +92,7 @@ public static string MaleFirstName(this AnonymousValueFixture fixture) /// The generated suffix public static string Suffix(this AnonymousValueFixture fixture) { - if (_personNameSuffixSource == null) _personNameSuffixSource = new PersonNameSuffixSource(); - return _personNameSuffixSource.Next(); + return fixture.PersonNameSuffix(); } /// @@ -131,10 +102,7 @@ public static string Suffix(this AnonymousValueFixture fixture) /// The generated title public static string Title(this AnonymousValueFixture fixture) { - if (_personNameTitleSource == null) _personNameTitleSource = new PersonNameTitleSource(); - return _personNameTitleSource.Next(); + return fixture.PersonNameTitle(); } - } - } diff --git a/TestStack.Dossier/EquivalenceClasses/PersonEquivalence.cs b/TestStack.Dossier/EquivalenceClasses/PersonEquivalence.cs new file mode 100644 index 0000000..aa544c8 --- /dev/null +++ b/TestStack.Dossier/EquivalenceClasses/PersonEquivalence.cs @@ -0,0 +1,159 @@ +using TestStack.Dossier.DataSources.Dictionaries; +using TestStack.Dossier.DataSources.Generators; + +// ReSharper disable once CheckNamespace +namespace TestStack.Dossier +{ + /// + /// Extension methods that describe equivalence classes for generating anonymous Person-related values. + /// + public static class PersonEquivalence + { + private static Words _personEmailAddressSource; + private static Words _uniquePersonEmailAddressSource; + + /// + /// Generate and return a unique email address (within the fixture). + /// + /// The fixture to generate a unique email for + /// The generated unique email + public static string PersonUniqueEmailAddress(this AnonymousValueFixture fixture) + { + if (_uniquePersonEmailAddressSource == null) + { + fixture.ResetUniqueEmailAddressSource(); + } + + return _uniquePersonEmailAddressSource.Next(); + } + + internal static void ResetUniqueEmailAddressSource(this AnonymousValueFixture fixture) + { + if (_personEmailAddressSource == null) _personEmailAddressSource = fixture.Words(FromDictionary.PersonEmailAddress); + var generator = new SequentialGenerator(0, _personEmailAddressSource.Data.Count, listShouldBeUnique: true); + _uniquePersonEmailAddressSource = new Words(generator, new CachedFileDictionaryRepository(), + FromDictionary.PersonEmailAddress); + } + + /// + /// Generate and return a person email address. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string PersonEmailAddress(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.PersonEmailAddress).Next(); + } + + /// + /// Generate and return a person language. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string PersonLanguage(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.PersonLanguage).Next(); + } + + /// + /// Generate and return a person first name. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string PersonNameFirst(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.PersonNameFirst).Next(); + } + + /// + /// Generate and return a person female first name. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string PersonNameFirstFemale(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.PersonNameFirstFemale).Next(); + } + + /// + /// Generate and return a person male first name. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string PersonNameFirstMale(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.PersonNameFirstMale).Next(); + } + + /// + /// Generate and return a person full name. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string PersonNameFull(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.PersonNameFull).Next(); + } + + /// + /// Generate and return a person last name. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string PersonNameLast(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.PersonNameLast).Next(); + } + + /// + /// Generate and return a person name suffix. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string PersonNameSuffix(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.PersonNameSuffix).Next(); + } + + /// + /// Generate and return a person name title. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string PersonNameTitle(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.PersonNameTitle).Next(); + } + + /// + /// Generate and return a person password. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string PersonPassword(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.PersonPassword).Next(); + } + + /// + /// Generate and return a person race. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string PersonRace(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.PersonRace).Next(); + } + + /// + /// Generate and return a person user name. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string PersonUsername(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.PersonUsername).Next(); + } + + } +} \ No newline at end of file diff --git a/TestStack.Dossier/EquivalenceClasses/ShirtSizeEquivalence.cs b/TestStack.Dossier/EquivalenceClasses/ShirtSizeEquivalence.cs new file mode 100644 index 0000000..8c2224d --- /dev/null +++ b/TestStack.Dossier/EquivalenceClasses/ShirtSizeEquivalence.cs @@ -0,0 +1,22 @@ +using TestStack.Dossier.DataSources.Dictionaries; + +// ReSharper disable once CheckNamespace +namespace TestStack.Dossier +{ + /// + /// Extension methods that describe equivalence classes for generating anonymous Shirt Size-related values. + /// + public static class ShirtSizeEquivalence + { + /// + /// Generate and return a shirt size. + /// + /// The fixture to generate a value for. + /// The generated value. + public static string ShirtSize(this AnonymousValueFixture fixture) + { + return fixture.Words(FromDictionary.ShirtSize).Next(); + } + + } +} diff --git a/TestStack.Dossier/Suppliers/DefaultEmailValueSupplier.cs b/TestStack.Dossier/Suppliers/DefaultEmailValueSupplier.cs index 5db3f94..554f9c6 100644 --- a/TestStack.Dossier/Suppliers/DefaultEmailValueSupplier.cs +++ b/TestStack.Dossier/Suppliers/DefaultEmailValueSupplier.cs @@ -1,5 +1,5 @@ using System; -using TestStack.Dossier.EquivalenceClasses.Person; +using TestStack.Dossier.EquivalenceClasses; namespace TestStack.Dossier.Suppliers { @@ -17,7 +17,7 @@ public bool CanSupplyValue(Type type, string propertyName) /// public object GenerateAnonymousValue(AnonymousValueFixture any, Type type, string propertyName) { - return any.EmailAddress(); + return any.PersonEmailAddress(); } } } diff --git a/TestStack.Dossier/Suppliers/DefaultFirstNameValueSupplier.cs b/TestStack.Dossier/Suppliers/DefaultFirstNameValueSupplier.cs index 57edf91..d973f62 100644 --- a/TestStack.Dossier/Suppliers/DefaultFirstNameValueSupplier.cs +++ b/TestStack.Dossier/Suppliers/DefaultFirstNameValueSupplier.cs @@ -1,5 +1,5 @@ using System; -using TestStack.Dossier.EquivalenceClasses.Person; +using TestStack.Dossier.EquivalenceClasses; namespace TestStack.Dossier.Suppliers { @@ -17,7 +17,7 @@ public bool CanSupplyValue(Type type, string propertyName) /// public object GenerateAnonymousValue(AnonymousValueFixture any, Type type, string propertyName) { - return any.FirstName(); + return any.PersonNameFirst(); } } } diff --git a/TestStack.Dossier/Suppliers/DefaultLastNameValueSupplier.cs b/TestStack.Dossier/Suppliers/DefaultLastNameValueSupplier.cs index a5f3fc0..98781fb 100644 --- a/TestStack.Dossier/Suppliers/DefaultLastNameValueSupplier.cs +++ b/TestStack.Dossier/Suppliers/DefaultLastNameValueSupplier.cs @@ -1,5 +1,5 @@ using System; -using TestStack.Dossier.EquivalenceClasses.Person; +using TestStack.Dossier.EquivalenceClasses; namespace TestStack.Dossier.Suppliers { @@ -18,7 +18,7 @@ public bool CanSupplyValue(Type type, string propertyName) /// public object GenerateAnonymousValue(AnonymousValueFixture any, Type type, string propertyName) { - return any.LastName(); + return any.PersonNameLast(); } } } diff --git a/TestStack.Dossier/TestStack.Dossier.csproj b/TestStack.Dossier/TestStack.Dossier.csproj index db23423..3c2d083 100644 --- a/TestStack.Dossier/TestStack.Dossier.csproj +++ b/TestStack.Dossier/TestStack.Dossier.csproj @@ -22,6 +22,7 @@ prompt 4 bin\Debug\TestStack.Dossier.xml + 5 pdbonly @@ -52,34 +53,49 @@ - - - - - - - + + - - + - - + + + - + + + + + + + + + + + + + + + + + + + + + @@ -182,9 +198,8 @@ - - - + +