public void Customize_ValidProperties_FixtureShouldBeCustomized(
            MyFixture myFixture,
            AutoMappedPropertyCustomization <A, B, int> sut)
        {
            //Exercise
            sut.Customize(myFixture.Fixture);

            //Verify
            FixtureShouldBeCustomized(myFixture, sut);
        }
Ejemplo n.º 2
0
        protected void FixtureShouldBeCustomized <TSource, TDestination, TValue>(
            MyFixture <TSource, TDestination, TValue> myFixture,
            MappedPropertyCustomization <TSource, TDestination, TValue> sut)
        {
            myFixture.SourcePropertyComposerMock
            .Verify(x => x.With(sut.SourceProperty, sut.Value));

            myFixture.DestinationPropertyComposerMock
            .Verify(x => x.FromFactory(It.Is <Func <Expression <Func <TDestination, TValue> > > >(f => f() == sut.DestinationProperty)));
        }
        public void Customize_ValidProperties_FixtureShouldBeCustomized(
            MyFixture myFixture,
            AutoMappedPropertyCustomization<A, B, int> sut)
        {
            //Exercise
            sut.Customize(myFixture.Fixture);

            //Verify
            FixtureShouldBeCustomized(myFixture, sut);
        }
        public void Construct_IntToShortProperties_ShouldThrowArgumentException(
            MyFixture <B, A, int> myFixture,
            Expression <Func <B, int> > sourceProperty,
            int value)
        {
            //Exercise
            Action act = () => new AutoMappedPropertyCustomization <B, A, int>(sourceProperty, value);

            //Verify
            act.ShouldThrow <ArgumentException>()
            .WithMessage("Expression of type 'System.Int16' cannot be used for return type 'System.Int32'");
        }
        public void Construct_IntToShortProperties_ShouldThrowArgumentException(
            MyFixture<B, A, int> myFixture,
            Expression<Func<B, int>> sourceProperty,
            int value)
        {
            //Exercise
            Action act = () => new AutoMappedPropertyCustomization<B, A, int>(sourceProperty, value);

            //Verify
            act.ShouldThrow<ArgumentException>()
                .WithMessage("Expression of type 'System.Int16' cannot be used for return type 'System.Int32'");
        }
 public PushNotificationsHubMockBuilder()
 {
     With(x => x.NotificationHubConnectionString, MyFixture.Create <string>());
     With(x => x.NotificationHubName, MyFixture.Create <string>());
 }