Пример #1
0
        public void TestFirstGuidConversionSuccess() {
            var parameter = new CommandParameter() {
                Data = {
                    Content = new List<String>() {
                        "9D2B0228-4D0D-4C23-8B49-01A698857709"
                    }
                }
            };

            Assert.AreEqual(new Guid("9D2B0228-4D0D-4C23-8B49-01A698857709"), parameter.First<Guid>());
        }
Пример #2
0
        public void TestFirstGuidConversionFailed() {
            var parameter = new CommandParameter() {
                Data = {
                    Content = new List<String>() {
                        "Invalid"
                    }
                }
            };

            Assert.AreEqual(default(Guid), parameter.First<Guid>());
        }
Пример #3
0
        public void TestFirstDateTimeConversionSuccess() {
            var parameter = new CommandParameter() {
                Data = {
                    Content = new List<String>() {
                        "2014-04-14 13:50:59"
                    }
                }
            };

            Assert.AreEqual(DateTime.Parse("2014-04-14 13:50:59"), parameter.First<DateTime>());
        }
Пример #4
0
        public void TestFirstEnumConversionSuccess() {
            var parameter = new CommandParameter() {
                Data = {
                    Content = new List<String>() {
                        "Six"
                    }
                }
            };

            Assert.AreEqual(ExecutableEnum.Six, parameter.First<ExecutableEnum>());
        }
Пример #5
0
        public void TestFirstKnownTypeSuccess() {
            var parameter = new CommandParameter() {
                Data = {
                    Content = new List<String>() {
                        "1",
                        "Anything",
                        "Nothing"
                    }
                }
            };

            Assert.AreEqual("1", parameter.First<String>(false));
        }
Пример #6
0
        public void TestFirstIntegerConversionSuccess() {
            var parameter = new CommandParameter() {
                Data = {
                    Content = new List<String>() {
                        "1"
                    }
                }
            };

            Assert.AreEqual(1, parameter.First<int>());
        }