コード例 #1
0
        public void PropertyContainer_Transfer_PrimitiveFields()
        {
            var src = new StructContainerWithPrimitives {
                Int32Value = 10
            };
            var dst = new StructContainerWithPrimitives {
                Int32Value = 20
            };

            using (var result = PropertyContainer.Transfer(ref dst, ref src))
            {
                Assert.That(result.Succeeded, Is.True);
                Assert.AreEqual(10, dst.Int32Value);
            }
        }
コード例 #2
0
        public void PropertyContainer_Transfer_FlagsEnumFields()
        {
            var src = new StructContainerWithPrimitives {
                FlagsEnum = FlagsEnum.Value1 | FlagsEnum.Value4
            };
            var dst = new StructContainerWithPrimitives {
                FlagsEnum = FlagsEnum.None
            };

            using (var result = PropertyContainer.Transfer(ref dst, ref src))
            {
                Assert.That(result.Succeeded, Is.True);
                Assert.AreEqual(FlagsEnum.Value1 | FlagsEnum.Value4, dst.FlagsEnum);
            }
        }