Exemplo n.º 1
0
        public void CustomGeneratorFillTest()
        {
            var filler = new RandomFiller.Builder()
                         .ValueFactoryForType(typeof(String), () => "MyCustomValue")
                         .EnableLogging(true)
                         .Build();

            var dto = filler.FillWithRandom(new MyStringDto());

            Assert.NotNull(dto.MyString);
            Assert.AreEqual("MyCustomValue", dto.MyString);

            var dtoNested = filler.FillWithRandom(new MyNestedStringDto());

            Assert.NotNull(dtoNested.MyStringDto);
            Assert.NotNull(dtoNested.MyStringDto.MyString);
            Assert.AreEqual("MyCustomValue", dtoNested.MyStringDto.MyString);
        }
Exemplo n.º 2
0
        public void CustomGeneratorFillTest()
        {
            var filler = new RandomFiller.Builder()
                .ValueFactoryForType(typeof(String), () => "MyCustomValue")
                .EnableLogging(true)
                .Build();

            var dto = filler.FillWithRandom(new MyStringDto());
            Assert.NotNull(dto.MyString);
            Assert.AreEqual("MyCustomValue", dto.MyString);

            var dtoNested = filler.FillWithRandom(new MyNestedStringDto());
            Assert.NotNull(dtoNested.MyStringDto);
            Assert.NotNull(dtoNested.MyStringDto.MyString);
            Assert.AreEqual("MyCustomValue", dtoNested.MyStringDto.MyString);
        }