Ejemplo n.º 1
0
        public void Add_ParserWithType_ReplacesExistingOfSameGenericType(IBObjectParser parser)
        {
            var list = new BObjectParserList();
            list.Add(typeof(BString), parser);
            list.Add(typeof(BString), parser);

            list.Should().HaveCount(1);
            list.Should().ContainSingle(x => x.Value == parser);
        }
Ejemplo n.º 2
0
        public void Add_GenericParser_ReplacesExistingOfSameGenericType(IBObjectParser<IBObject> parser)
        {
            var list = new BObjectParserList();
            list.Add(parser);
            list.Add(parser);

            list.Should().HaveCount(1);
            list.Should().ContainSingle(x => x.Value == parser);
        }
Ejemplo n.º 3
0
        public void Add_ParserWithType_ReplacesExistingOfSameGenericType(IBObjectParser parser)
        {
            var list = new BObjectParserList();

            list.Add(typeof(BString), parser);
            list.Add(typeof(BString), parser);

            list.Should().HaveCount(1);
            list.Should().ContainSingle(x => x.Value == parser);
        }
Ejemplo n.º 4
0
        public void Add_GenericParser_ReplacesExistingOfSameGenericType(IBObjectParser <IBObject> parser)
        {
            var list = new BObjectParserList();

            list.Add(parser);
            list.Add(parser);

            list.Should().HaveCount(1);
            list.Should().ContainSingle(x => x.Value == parser);
        }
Ejemplo n.º 5
0
        public void Add_ParserWithNonIBObjectType_ThrowsArgumentException(Type type, IBObjectParser parser)
        {
            var    list   = new BObjectParserList();
            Action action = () => list.Add(type, parser);

            action.ShouldThrow <ArgumentException>("because only IBObject types are allowed");
        }
Ejemplo n.º 6
0
        public void Add_ParserWithNonIBObjectType_ThrowsArgumentException(Type type, IBObjectParser parser)
        {
            var list = new BObjectParserList();
            Action action = () => list.Add(type, parser);

            action.ShouldThrow<ArgumentException>("because only IBObject types are allowed");
        }
Ejemplo n.º 7
0
        public void Add_GenericParser_ContainsOnlyThatParser(IBObjectParser<IBObject> parser)
        {
            var list = new BObjectParserList();
            list.Add(parser);

            list.Should().HaveCount(1);
            list.Should().ContainSingle(x => x.Value == parser);
        }
Ejemplo n.º 8
0
        public void Add_GenericParser_AddedWithGenericTypeAsKey(IBObjectParser<IBObject> parser)
        {
            var list = new BObjectParserList();
            list.Add(parser);

            list.Should().HaveCount(1);
            list.Should().ContainSingle(x => x.Key == typeof(IBObject));
        }
Ejemplo n.º 9
0
        public void Add_GenericParser_AddedWithGenericTypeAsKey(IBObjectParser <IBObject> parser)
        {
            var list = new BObjectParserList();

            list.Add(parser);

            list.Should().HaveCount(1);
            list.Should().ContainSingle(x => x.Key == typeof(IBObject));
        }
Ejemplo n.º 10
0
        public void Add_GenericParser_ContainsOnlyThatParser(IBObjectParser <IBObject> parser)
        {
            var list = new BObjectParserList();

            list.Add(parser);

            list.Should().HaveCount(1);
            list.Should().ContainSingle(x => x.Value == parser);
        }
Ejemplo n.º 11
0
        public void Add_WithMultipleTypes_AddsParserForEachType(IBObjectParser parser)
        {
            var types = new[] {typeof (BString), typeof (BNumber), typeof (BList)};

            var list = new BObjectParserList();
            list.Add(types, parser);

            list.Should().HaveCount(3);
            list.Should().OnlyContain(x => x.Value == parser);
        }
Ejemplo n.º 12
0
        public void Add_WithMultipleTypes_AddsParserForEachType(IBObjectParser parser)
        {
            var types = new[] { typeof(BString), typeof(BNumber), typeof(BList) };

            var list = new BObjectParserList();

            list.Add(types, parser);

            list.Should().HaveCount(3);
            list.Should().OnlyContain(x => x.Value == parser);
        }