public void It_ShouldBuildAfterAddingValuesAndReset() { var expected = new TestHelperClass { Prop2 = 54 }; var sut = new GenericBuilder <TestHelperClass>(new TestHelperClass { Prop2 = 54 }); sut.WithValue(x => x.Prop1, "some value") .WithValue(x => x.Prop3, true) .Reset(); sut.Build().Should().BeEquivalentTo(expected); }
public void It_ShouldCreateBuilderOutOfFuncOfModel() { Func <TestHelperClass> myClassGetter = () => new TestHelperClass { Prop1 = "some value", Prop2 = 54, Prop3 = true }; var expected = new TestHelperClass { Prop1 = "some value", Prop2 = 54, Prop3 = true }; GenericBuilder <TestHelperClass> result = myClassGetter.AsBuilder(); result.Build().Should().BeEquivalentTo(expected); }
public async Task It_ShouldCreateBuilderOutOfAsyncModel() { Task <TestHelperClass> myClassGetter = Task.FromResult( new TestHelperClass { Prop1 = "some value", Prop2 = 54, Prop3 = true } ); var expected = new TestHelperClass { Prop1 = "some value", Prop2 = 54, Prop3 = true }; GenericBuilder <TestHelperClass> result = await myClassGetter.AsBuilderAsync(); result.Build().Should().BeEquivalentTo(expected); }