Beispiel #1
0
        public void Create_ShouldReturnCorrectLength()
        {
            var count = IntegerGenerator.AnyIntegerInRange(2, 100);

            var result = _sut.BuildMany <TestClass>(count)
                         .Create();

            result.Should().HaveCount(count);
        }
Beispiel #2
0
        public void Without_PropertyIsNotSet()
        {
            var count = IntegerGenerator.AnyIntegerInRange(2, 100);

            var result = _sut.BuildMany <TestClass>(count)
                         .Without(r => r.StringProperty);

            result.Select(r => r.Create().StringProperty)
            .All(r => r == null).Should().BeTrue();
        }
Beispiel #3
0
        public void With_WhenPropertyValueIsPassedIn_PropertyHasValue()
        {
            var count = IntegerGenerator.AnyIntegerInRange(2, 100);
            var value = StringGenerator.AnyNonNullString();

            var result = _sut.BuildMany <TestClass>(count)
                         .With(r => r.StringProperty, value);

            result.Select(r => r.Create().StringProperty).All(r => r.Equals(value)).Should().BeTrue();
        }
Beispiel #4
0
        public void WithAutoProperties_ShouldNotSetAutoProperties()
        {
            _sut.OmitAutoProperties = false;
            var count = IntegerGenerator.AnyIntegerInRange(2, 100);

            var result = _sut.BuildMany <TestClass>(count)
                         .OmitAutoProperties();

            result.Select(r => r.Create().StringProperty)
            .All(r => r == null).Should().BeTrue();
        }
Beispiel #5
0
        public void With_WhenPropertyFunctionIsPassedIn_FuncIsExecutedCorrectTimes()
        {
            var count    = IntegerGenerator.AnyIntegerInRange(2, 100);
            var executed = 0;

            string ValueFunction()
            {
                executed++;
                return(StringGenerator.AnyNonNullString());
            }

            var result = _sut.BuildMany <TestClass>(count)
                         .With(r => r.StringProperty, ValueFunction);

            result.ForEach(r => r.Create());
            executed.Should().Be(count);
        }