Esempio n. 1
0
        public void ActLikeAMapperWithAdditionalOverwritingProperties(
            SampleClass src,
            SampleClassTwo similarTarget)
        {
            "Given an instance of a class with two properties"
            .x(() => src = new SampleClass
            {
                IntProperty    = 6,
                StringProperty = "something"
            });

            "When I assign it to a new object with an extra property"
            .x(() => { similarTarget = Objectify.Assign <SampleClassTwo>(src, new { intproperty = 7 }, new { stringproperty = "seven" }); });

            "Then that object should have those properties"
            .x(() =>
            {
                Assert.Equal(7, similarTarget.IntProperty);
                Assert.Equal("seven", similarTarget.StringProperty);
            });
        }
Esempio n. 2
0
        public void ActLikeAMapper(
            SampleClass src,
            SampleClassTwo similarTarget)
        {
            "Given an instance of a class with two properties"
            .x(() => src = new SampleClass
            {
                IntProperty    = 6,
                StringProperty = "something"
            });

            "When I assign it to a new object with an extra property"
            .x(() => { similarTarget = Objectify.Assign <SampleClassTwo>(src); });

            "Then that object should have those properties"
            .x(() =>
            {
                Assert.Equal(similarTarget.IntProperty, src.IntProperty);
                Assert.Equal(similarTarget.StringProperty, src.StringProperty);
            });

            "And they shouldn't be the same reference"
            .x(() => Assert.False(ReferenceEquals(src, similarTarget)));
        }