public void SetStringAndIntStateByNameUsingNamedArgument(string expectedString, int expectedInt)
        {
            var sut = A.BuilderFor<SampleType>();

            sut.With(stringProperty: expectedString, intProperty: expectedInt);
            SampleType result = sut.Build();

            var expected = new SampleType { StringProperty = expectedString, IntProperty = expectedInt };
            Assert.Equal(expected, result, new SampleTypeEqualityComparer());
        }
Ejemplo n.º 2
0
        public void UsageWithImplicitCast()
        {
            const string stringProperty = "expected value";
            var expected = new SampleType
            {
                StringProperty = stringProperty
            };

            SampleType built = A.BuilderFor<SampleType>()
                                    .WithStringProperty(stringProperty);

            Assert.Equal(expected, built, new SampleTypeEqualityComparer());
        }
Ejemplo n.º 3
0
        public void UsageWithComplexType()
        {
            var complexProperty = new Exception();
            var expected = new SampleType
            {
                ComplexProperty = complexProperty
            };

            SampleType built = A.BuilderFor<SampleType>()
                                    .WithComplexProperty(complexProperty);

            Assert.Equal(expected, built, new SampleTypeEqualityComparer());
        }
Ejemplo n.º 4
0
        public void UsageWithNamedArgument()
        {
            const string expectedStringValue = "expected value";
            const int expectedIntValue = 1;
            var expected = new SampleType
            {
                StringProperty = expectedStringValue,
                IntProperty = expectedIntValue
            };

            SampleType built = A.BuilderFor<SampleType>()
                                    .With(stringProperty: expectedStringValue,
                                          intProperty: expectedIntValue);

            Assert.Equal(expected, built, new SampleTypeEqualityComparer());
        }