Пример #1
0
        public void TestDateTime()
        {
            var commandChannel = Mock.Of <ICommandChannel>(m =>
                                                           m.FetchValue(It.IsAny <string>(), It.IsAny <IEnumerable <KeyValuePair <string, IConvertible> > >()) == (IConvertible)DateTime.MinValue
                                                           );

            var executor = new SingleValueExecutor();

            Assert.AreEqual(DateTime.MinValue, executor.ExecuteOnAdapter(commandChannel, "date"));
        }
Пример #2
0
        public void TestString()
        {
            var commandChannel = Mock.Of <ICommandChannel>(m =>
                                                           m.FetchValue(It.IsAny <string>(), It.IsAny <IEnumerable <KeyValuePair <string, IConvertible> > >()) == "str"
                                                           );

            var executor = new SingleValueExecutor();

            Assert.AreEqual("str", executor.ExecuteOnAdapter(commandChannel, "string"));
        }
Пример #3
0
        public void TestExceptionsNotSwallowed()
        {
            var executor = new SingleValueExecutor();

            var commandChannel = new Mock <ICommandChannel>();

            commandChannel
            .Setup(m => m.FetchValue(It.IsAny <string>(), It.IsAny <IDictionary <string, IConvertible> >()))
            .Throws <VerySpecificException>();

            Assert.ThrowsException <VerySpecificException>(() => executor.ExecuteOnAdapter(commandChannel.Object, ""));
        }