コード例 #1
0
        public void NoWith_Should_GenerateCopyOfStub()
        {
            var original = StubFactory.GetNoWithStub();
            var with     = original.With();

            Assert.IsType <NoWithStub>(original);
            Assert.IsType <WithStub>(with);

            Assert.Equal(original.IntProperty, with.IntProperty);
            Assert.Equal(original.DoubleProperty, with.DoubleProperty);
            Assert.Equal(original.StringProperty, with.StringProperty);
            Assert.Equal(original.GuidProperty, with.GuidProperty);
            Assert.Equal(original.DateTimeOffsetProperty, with.DateTimeOffsetProperty);
        }
コード例 #2
0
        public void WithAction_Should_GenerateCopyOfStub_WithAction()
        {
            void SetAction(WithStub stub)
            {
                stub.IntProperty = StubFactory.IntPropertyValue + 1;
            }

            var original = StubFactory.GetNoWithStub();
            var with     = original.With((Action <WithStub>)SetAction);

            Assert.IsType <NoWithStub>(original);
            Assert.IsType <WithStub>(with);

            Assert.NotEqual(original.IntProperty, with.IntProperty);
            Assert.Equal(original.DoubleProperty, with.DoubleProperty);
            Assert.Equal(original.StringProperty, with.StringProperty);
            Assert.Equal(original.GuidProperty, with.GuidProperty);
            Assert.Equal(original.DateTimeOffsetProperty, with.DateTimeOffsetProperty);
        }