示例#1
0
        public void Resolve_Parser_Not_Found()
        {
            // arrange
            var dummy = new DummyResultParser();
            var dict = new Dictionary<Type, IResultParser> { { dummy.ResultType, dummy } };
            var resolver = new ResultParserCollection(dict);

            // act
            Action action = () => resolver.Get(typeof(int));

            // assert
            Assert.Throws<ArgumentException>(action);
        }
示例#2
0
        public void Resolve_Type_Is_Null()
        {
            // arrange
            var dummy = new DummyResultParser();
            var dict = new Dictionary<Type, IResultParser> { { dummy.ResultType, dummy } };
            var resolver = new ResultParserCollection(dict);

            // act
            Action action = () => resolver.Get(null);

            // assert
            Assert.Throws<ArgumentNullException>(action);
        }
示例#3
0
        public void Resolve_Parser()
        {
            // arrange
            var dummy = new DummyResultParser();
            var dict = new Dictionary<Type, IResultParser> { { dummy.ResultType, dummy } };
            var resolver = new ResultParserCollection(dict);

            // act
            IResultParser parser = resolver.Get(typeof(string));

            // assert
            Assert.NotNull(parser);
            Assert.IsType<DummyResultParser>(parser);
        }