public void Create_ShouldReturnCorrectLength() { var count = IntegerGenerator.AnyIntegerInRange(2, 100); var result = _sut.BuildMany <TestClass>(count) .Create(); result.Should().HaveCount(count); }
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(); }
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(); }
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(); }
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); }