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);
        }
        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);
        }
        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);
        }
        public void ShouldBeNotMatching_ParamProperty_Test()
        {
            var param = new ParamObject()
            {
                UserName     = "******",
                Age          = 255,
                NonAttribute = "Some Value"
            };

            var mapping = new ParamPropertyMappingProvider(param);
            var value   = mapping.Getter("NonAttribute");

            TestContext.WriteLine("NonAttribute Property : ", value);
        }
        public void ParamMappingObject_Getter_Test()
        {
            var param = new ParamObject()
            {
                UserName = "******",
                Age = 255
            };

            var mapping = new ParamPropertyMappingProvider(param);
            TestContext.WriteLine(mapping.Getter("UserName").ToString());
            TestContext.WriteLine(mapping.Getter("Age").ToString());

            Assert.AreEqual("NCsoft", mapping.Getter("UserName"));
            Assert.AreEqual(255, mapping.Getter("Age"));
        }
        public void ParamMappingObject_Setter_Test()
        {
            var param = new ParamObject()
            {
                UserName = "******",
                Age = 255
            };

            var mapping = new ParamPropertyMappingProvider(param);

            mapping.Setter("UserName", "NCsoft NCsoft");
            mapping.Setter("Age", 0);

            Assert.AreEqual("NCsoft NCsoft", mapping.Getter("UserName"));
            Assert.AreEqual(0, mapping.Getter("Age"));
        }
        public void ShouldBeCanGetter_via_NameValue_NameProperty_Test()
        {
            var param = new ParamObject()
            {
                UserName = "******",
                Age      = 255
            };

            var mapping = new ParamPropertyMappingProvider(param);

            Assert.AreEqual("NCsoft", mapping.Getter("username"));

            mapping.Setter("username", "NCsoft NCsoft");
            Assert.AreEqual("NCsoft NCsoft", mapping.Getter("username"));
            Assert.AreEqual("NCsoft NCsoft", param.UserName);
        }
        public void ParamMappingObject_Setter_Test()
        {
            var param = new ParamObject()
            {
                UserName = "******",
                Age      = 255
            };

            var mapping = new ParamPropertyMappingProvider(param);

            mapping.Setter("UserName", "NCsoft NCsoft");
            mapping.Setter("Age", 0);

            Assert.AreEqual("NCsoft NCsoft", mapping.Getter("UserName"));
            Assert.AreEqual(0, mapping.Getter("Age"));
        }
        public void ParamMappingObject_Getter_Test()
        {
            var param = new ParamObject()
            {
                UserName = "******",
                Age      = 255
            };

            var mapping = new ParamPropertyMappingProvider(param);

            TestContext.WriteLine(mapping.Getter("UserName").ToString());
            TestContext.WriteLine(mapping.Getter("Age").ToString());

            Assert.AreEqual("NCsoft", mapping.Getter("UserName"));
            Assert.AreEqual(255, mapping.Getter("Age"));
        }
        public void ShouldBe_Fire_Exception_Why_Not_Exists_Property_Possible_Mapping_Name_Test()
        {
            var watcher = Stopwatch.StartNew();

            var source = new Temp_SourceClass()
            {
                UserName = "******"
            };

            var target = new Temp_TargetClass();

            var sourceMapping = new MappingProviderForProperty(source);
            var targetMapping = new ParamPropertyMappingProvider(target);

            sourceMapping.AssignTo(targetMapping);
        }
        public void ShouldBeCanGetter_via_NameValue_NameProperty_Test()
        {
            var param = new ParamObject()
            {
                UserName = "******",
                Age = 255
            };

            var mapping = new ParamPropertyMappingProvider(param);
            Assert.AreEqual("NCsoft", mapping.Getter("username"));

            mapping.Setter("username", "NCsoft NCsoft");
            Assert.AreEqual("NCsoft NCsoft", mapping.Getter("username"));
            Assert.AreEqual("NCsoft NCsoft", param.UserName);
        }
        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);
        }
        public void ShouldBe_Fire_Exception_Why_Not_Exists_Property_Possible_Mapping_Name_Test()
        {
            var watcher = Stopwatch.StartNew();

            var source = new Temp_SourceClass()
            {
                UserName = "******"
            };

            var target = new Temp_TargetClass();

            var sourceMapping = new MappingProviderForProperty(source);
            var targetMapping = new ParamPropertyMappingProvider(target);

            sourceMapping.AssignTo(targetMapping);
        }
        public void ShouldBeNotMatching_ParamProperty_Test()
        {
            var param = new ParamObject()
            {
                UserName = "******",
                Age = 255,
                NonAttribute = "Some Value"
            };

            var mapping = new ParamPropertyMappingProvider(param);
            var value = mapping.Getter("NonAttribute");

            TestContext.WriteLine("NonAttribute Property : ", value);
        }