コード例 #1
0
        public void Just_Send_Param_Action_Test()
        {
            var sendParam = new ParamObjectLeft()
            {
                Both = "Both",
                OnlySend = "OnlySend",
                OnlyReceived = "OnlyReceived"
            };

            var receivedParam = new ParamObjectRight();

            var sendMapping = new ParamPropertyMappingProvider(sendParam);
            var receivedMapping = new ParamPropertyMappingProvider(receivedParam);

            sendMapping.AssignTo(receivedMapping);

            receivedParam.GetType()
                .GetProperties()
                .ToList()
                .ForEach(o =>
                {
                    Console.WriteLine("{0} = {1}", o.Name, o.GetValue(receivedParam, null) ?? "NULL");
                });

            Assert.AreEqual("Both", receivedParam.Both);
            Assert.AreEqual(null, receivedParam.OnlySend);
            Assert.AreEqual("OnlyReceived", receivedParam.OnlyReceived);
        }
コード例 #2
0
        public void Just_Send_Param_Action_Test()
        {
            var sendParam = new ParamObjectLeft()
            {
                Both         = "Both",
                OnlySend     = "OnlySend",
                OnlyReceived = "OnlyReceived"
            };

            var receivedParam = new ParamObjectRight();

            var sendMapping     = new ParamPropertyMappingProvider(sendParam);
            var receivedMapping = new ParamPropertyMappingProvider(receivedParam);

            sendMapping.AssignTo(receivedMapping);

            receivedParam.GetType()
            .GetProperties()
            .ToList()
            .ForEach(o =>
            {
                Console.WriteLine("{0} = {1}", o.Name, o.GetValue(receivedParam, null) ?? "NULL");
            });

            Assert.AreEqual("Both", receivedParam.Both);
            Assert.AreEqual(null, receivedParam.OnlySend);
            Assert.AreEqual("OnlyReceived", receivedParam.OnlyReceived);
        }
コード例 #3
0
        public void ShouldBe_Return_Value_When_Empty_Property_Test()
        {
            var sourceParam = new ParamObjectForDefaultValue();
            var targetParam = new ParamObjectForDefaultValue();

            var sourceMapping = new ParamPropertyMappingProvider(sourceParam);
            var targetMapping = new ParamPropertyMappingProvider(targetParam);

            sourceMapping.AssignTo(targetMapping);

            Assert.AreEqual("NCsoft", targetParam.UserName);

            TestContext.WriteLine(targetParam.UserName);
        }
コード例 #4
0
        public void ShouldBe_Return_Value_When_Empty_Property_Test()
        {
            var sourceParam = new ParamObjectForDefaultValue();
            var targetParam = new ParamObjectForDefaultValue();

            var sourceMapping = new ParamPropertyMappingProvider(sourceParam);
            var targetMapping = new ParamPropertyMappingProvider(targetParam);

            sourceMapping.AssignTo(targetMapping);

            Assert.AreEqual("NCsoft", targetParam.UserName);

            TestContext.WriteLine(targetParam.UserName);
        }