Exemplo n.º 1
0
        public void It_ShouldNotAddPropertyToBuilderPatches_WhenPropIsInvalid()
        {
            var sut = new GenericBuilder <TestHelperClass>(new TestHelperClass());

            sut.WithValue(x => x.Prop2 == 54, false);

            ((IGenericBuilder <TestHelperClass>)sut).Patches.Should().BeEmpty();
        }
Exemplo n.º 2
0
        public void It_ShouldAddPropertyToBuilderPatches()
        {
            var expected = new Operation <TestHelperClass>("replace", "/Prop1", null, "new value");

            var sut = new GenericBuilder <TestHelperClass>(new TestHelperClass());

            sut.WithValue(x => x.Prop1, "new value");

            ((IGenericBuilder <TestHelperClass>)sut).Patches.Should().BeEquivalentTo(expected);
        }
Exemplo n.º 3
0
        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);
        }