예제 #1
0
        public void TestAllDateTimeConversionFailure() {
            var parameter = new CommandParameter() {
                Data = {
                    Content = new List<String>() {
                        "2014-04-14 13:50:59",
                        "2014-04-11 03:23:13",
                        "Invalid"
                    }
                }
            };

            var items = parameter.All(typeof(DateTime)) as List<Object>;

            Assert.IsNull(items);
        }
예제 #2
0
        public void TestAllGuidConversionFailure() {
            var parameter = new CommandParameter() {
                Data = {
                    Content = new List<String>() {
                        "9D2B0228-4D0D-4C23-8B49-01A698857709",
                        "f380eb1e-1438-48c0-8c3d-ad55f2d40538",
                        "Invalid"
                    }
                }
            };

            var items = parameter.All(typeof(Guid)) as List<Object>;

            Assert.IsNull(items);
        }
예제 #3
0
        public void TestAllEnumConversionSuccess() {
            var parameter = new CommandParameter() {
                Data = {
                    Content = new List<String>() {
                        "Six",
                        "Seven"
                    }
                }
            };

            var items = (List<Object>)parameter.All(typeof (ExecutableEnum));

            Assert.AreEqual(ExecutableEnum.Six, items[0]);
            Assert.AreEqual(ExecutableEnum.Seven, items[1]);
        }
예제 #4
0
        public void TestAllIntegerConversionFailure() {
            var parameter = new CommandParameter() {
                Data = {
                    Content = new List<String>() {
                        "1",
                        "2",
                        "Invalid"
                    }
                }
            };

            var items = parameter.All(typeof (int)) as List<Object>;

            Assert.IsNull(items);
        }
예제 #5
0
        public void TestAllGuidConversionSuccess() {
            var parameter = new CommandParameter() {
                Data = {
                    Content = new List<String>() {
                        "9D2B0228-4D0D-4C23-8B49-01A698857709",
                        "f380eb1e-1438-48c0-8c3d-ad55f2d40538",
                        "76268850-2029-4b5f-b421-5b5ee4f17b6b"
                    }
                }
            };
            
            var list = (List<Object>)parameter.All(typeof(Guid));

            Assert.AreEqual(new Guid("9D2B0228-4D0D-4C23-8B49-01A698857709"), list[0]);
            Assert.AreEqual(new Guid("f380eb1e-1438-48c0-8c3d-ad55f2d40538"), list[1]);
            Assert.AreEqual(new Guid("76268850-2029-4b5f-b421-5b5ee4f17b6b"), list[2]);
        }
예제 #6
0
        public void TestAllDateTimeConversionSuccess() {
            var parameter = new CommandParameter() {
                Data = {
                    Content = new List<String>() {
                        "2014-04-14 13:50:59",
                        "2014-04-11 03:23:13",
                        "2014-04-10 03:23:13"
                    }
                }
            };
            
            var list = (List<Object>)parameter.All(typeof(DateTime));

            Assert.AreEqual(DateTime.Parse("2014-04-14 13:50:59"), list[0]);
            Assert.AreEqual(DateTime.Parse("2014-04-11 03:23:13"), list[1]);
            Assert.AreEqual(DateTime.Parse("2014-04-10 03:23:13"), list[2]);
        }
예제 #7
0
        public void TestAllKnownTypeSuccess() {
            var parameter = new CommandParameter() {
                Data = {
                    Content = new List<String>() {
                        "1",
                        "Anything",
                        "Nothing"
                    }
                }
            };

            List<String> items = ((List<Object>) parameter.All(typeof (String), false)).Cast<String>().ToList();

            Assert.AreEqual("1", items[0]);
            Assert.AreEqual("Anything", items[1]);
            Assert.AreEqual("Nothing", items[2]);
        }
예제 #8
0
        public void TestAllIntegerConversionSuccess() {
            var parameter = new CommandParameter() {
                Data = {
                    Content = new List<String>() {
                        "1",
                        "2",
                        "3"
                    }
                }
            };

            var list = (List<Object>)parameter.All(typeof (int));

            Assert.AreEqual(1, list[0]);
            Assert.AreEqual(2, list[1]);
            Assert.AreEqual(3, list[2]);
        }