public void CreateDefCtorStruct() { var actual = faker.Create <DefCtorStruct>(); var notExpected = new DefCtorStruct(); Assert.AreNotEqual(notExpected.field1, actual.field1); }
public void TestSimpleConfig() { Foo foo = faker.Create <Foo>(); Assert.AreEqual(foo.DeterminedString, "ShoGeneratorString"); Assert.AreNotEqual(foo.VolatileString, "ShoGeneratorString"); }
public void NotNullResult() { Setup(); SimpleDTO obj = faker.Create <SimpleDTO>(); Assert.IsNotNull(obj); }
public void PrivateConstructorTest() { faker = new Faker(); Assert.IsTrue(faker.Create <PrivateCtorTestClass>() == null); Assert.IsFalse(faker.Create <PrivateCtorTestClass>() != null); }
public void SetUp() { faker = new Faker(); foo = faker.Create <Foo>(); bar = faker.Create <Bar>(); emptyConstructor = faker.Create <EmptyConstructor>(); }
public void TestAllTypeMeth() { TestAllType testAllType = Faker.Create <TestAllType>(); Assert.IsNotNull(testAllType); Assert.AreNotEqual(testAllType.Char, ""); }
static void Main(string[] args) { Faker faker = new Faker(); Bar bar = faker.Create <Bar>(); Foo foo = faker.Create <Foo>(); OutputProperties(bar); Console.ReadKey(); }
public void CreationTest() { faker.Register <string>(() => testResult); var value = faker.Create <string>(); Assert.IsInstanceOf <string>(value); Assert.AreSame(testResult, value); }
static void Main(string[] args) { var faker = new Faker(); FirstClass firstClass = faker.Create <FirstClass>(); SecondClass secondClass = faker.Create <SecondClass>(); Console.WriteLine(JsonSerializer.Serialize(firstClass)); Console.WriteLine(JsonSerializer.Serialize(secondClass)); }
public void CreationTest() { var value = faker.Create <Task>(); Assert.IsInstanceOf <Task>(value); var value2 = faker.Create <Task <int> >(); Assert.IsInstanceOf(typeof(Task <int>), value2); }
public void TestCreate() { var obj = faker.Create <B>(); Assert.IsNotNull(obj); Assert.IsNull(obj.a); Assert.IsNull(faker.Create <String>()); Assert.IsNotNull(obj.c); Assert.AreNotEqual(obj.c.b, obj); }
public void ShouldCreateOnlyDTO() { Faker faker = new Faker(); Bar bar = faker.Create <Bar>(); NotDtoClass notDto = faker.Create <NotDtoClass>(); Assert.NotNull(bar); Assert.Null(notDto); }
public void When_FakerCreates_Expect_NotNullValues() { A a = faker.Create <A>(); Assert.Multiple(() => { Assert.NotNull(a.a); Assert.NotZero(a.a.Length); Assert.NotZero(a.b); }); }
public void SimpleClassTest() { Foo foo = faker.Create <Foo>(); Assert.IsNotNull(foo); Assert.AreEqual(GetDefaultValue(typeof(int)), foo.a); Assert.AreNotEqual(GetDefaultValue(typeof(int)), foo.b); Assert.AreNotEqual(GetDefaultValue(typeof(float)), foo.d); Assert.AreNotEqual(GetDefaultValue(typeof(DateTime)), foo.e); Assert.AreNotEqual(GetDefaultValue(typeof(double)), foo.f); Assert.AreNotEqual(GetDefaultValue(typeof(double)), foo.g); }
public void TestDefaultGenerators() { DefaultGeneratorsClass testClass = _faker.Create <DefaultGeneratorsClass>(); Assert.NotZero(testClass.testInt); Assert.NotZero(testClass.testLong); Assert.NotZero(testClass.testFloat); Assert.NotZero(testClass.testDouble); Assert.NotZero(testClass.testChar); Assert.IsNotNull(testClass.testString); Assert.IsNotNull(testClass.testDate); }
public static void Main(string[] args) { FakerConfig config = new FakerConfig(); config.Add <ExampleClassProperties, int, IntNonRandomGenerator>(ex => ex.CustomGeneratorCheckProperty); config.Add <ExampleClassConstructor, int, IntNonRandomGenerator>(ex => ex.CustomGeneratorCheckProperty2); Faker faker = new Faker(config); ConsoleJsonSerializer.Serialize(faker.Create <ExampleClassProperties>()); ConsoleJsonSerializer.Serialize(faker.Create <ExampleClassConstructor>()); Console.ReadKey(); }
static void Main(string[] args) { FakerConfig config = new FakerConfig(); config.Add <Test, string, HelloGenerator>(x => x.stringField); Faker faker = new Faker(config); Test test = faker.Create <Test>(); TestStruct s = faker.Create <TestStruct>(); List <Test> lt = faker.Create <List <Test> >(); UriBuilder builder = new UriBuilder(); Uri uri = faker.Create <Uri>(); DateTime dt = faker.Create <DateTime>(); Console.WriteLine(Serialize(test)); }
static void Main(string[] args) { Faker faker = new Faker(); Bar f = faker.Create <Bar>(); Console.WriteLine(f == null); Faker faker2 = new Faker(); Too _too = faker2.Create <Too>(); Faker _faker = new Faker(); Dict _testdict = _faker.Create <Dict>(); Assembly ass = Assembly.LoadFile("C:\\Users\\USER\\source\\repos\\ClassLibrary3\\GeneratorsLib\\bin\\Debug\\GeneratorsLib.dll"); Type[] tt = ass.GetTypes(); Toos ssss = _faker.Create <Toos>(); }
public void CanFakeANullableTimeSpan() { var value = Faker.Create <TimeSpan?>(); value.Should().BeGreaterThan(TimeSpan.MinValue); value.Should().BeLessThan(TimeSpan.MaxValue); }
static void Main(string[] args) { RegisterGen.Register(new IntGen()); RegisterGen.Register(new StrGen()); RegisterGen.Register(new DateGen()); RegisterGen.Register(new ListGen()); RegisterGen.RegisterPlugins(); var faker = new Faker(); Foo foo = faker.Create <Foo>(); Moo moo = faker.Create <Moo>(); Console.WriteLine(JsonConvert.SerializeObject(foo)); Console.WriteLine(JsonConvert.SerializeObject(moo)); }
public void Create_BoolPropFilling_testboolFilled() { Faker _faker = new Faker(); Too too = _faker.Create <Too>(); Assert.AreNotEqual(too._testbool, default(bool)); }
public void Create_FillDictionary_testdictFilled() { Faker _faker = new Faker(); Dict _testdict = _faker.Create <Dict>(); Assert.IsTrue(_testdict._testdict.Count > 0); }
public void Create_FillList_testListFilled() { Faker _faker = new Faker(); Too _testList = _faker.Create <Too>(); Assert.IsTrue(_testList._testllist.Count > 0); }
public void Create_FillPropertyOfOtherClass_propertyfield() { Faker _faker = new Faker(); Bar _teststr = _faker.Create <Bar>(); Assert.IsNotNull(_teststr._testFoo); }
public void Create_FillPropertyByConstructor_teststrFilled() { Faker _faker = new Faker(); Foo _teststr = _faker.Create <Foo>(); Assert.IsNotNull(_teststr.teststr); }
public void Create_SimpleObject_GenerateObj() { Faker _faker = new Faker(); Foo _teststr = _faker.Create <Foo>(); Assert.IsNotNull(_teststr); }
public void Create_ByteFilling_ByteTypePropFilled() { Faker _faker = new Faker(); Too too = _faker.Create <Too>(); Assert.AreNotEqual(too._byte, default(byte)); }
public void WillPickTypeAtRandom() { var realClassFound = false; var anotherClassFound = false; var evenAnotherClassFound = false; for (var i = 0; i < 35; i++) { var item = Faker.Create <SomeClass>(); if (item.ThisIsNotReal is RealClass) { realClassFound = true; } if (item.ThisIsNotReal is AnotherClass) { anotherClassFound = true; } if (item.ThisIsNotReal is EvenAnotherClass) { evenAnotherClassFound = true; } } realClassFound.Should().BeTrue(); anotherClassFound.Should().BeTrue(); evenAnotherClassFound.Should().BeTrue(); }
static void Main(string[] args) { Faker creator = new Faker(); Test test = creator.Create <Test>(); Console.ReadLine(); }
public static void Main(string[] args) { // DictionaryOfGenerators dict = new DictionaryOfGenerators(); // var config = new FakerConfig(dict); // // config.Add<TestClass1, string, StringConfigGenerator>(TestClass1 => TestClass1.str ); // Faker faker = new Faker(dict); // TestClass1 obj = faker.Create<TestClass1>(); // // if(obj != null) // new ConsoleWriter().GetClassFields<TestClass1>(obj); // Faker faker2 = new Faker(new DictionaryOfGenerators()); // TestClass2 test2 = faker2.Create<TestClass2>(); // if(test2 != null) // new ConsoleWriter().GetClassFields<TestClass2>(test2); Faker faker4 = new Faker(new DictionaryOfGenerators()); TestClass4 test4 = faker4.Create <TestClass4>(); if (test4 != null) { new ConsoleWriter().GetClassFields <TestClass4>(test4); } }