Пример #1
0
        public void Read_When_Incorrect_Namespace_Should_Log_So_And_Return_False()
        {
            var bookReader = new Fb2Reader(_testLogger,
                                           new XElement("book").CreateReader());

            bookReader.ReadElement(Nsp + "book").Should().BeFalse();
            _testLogger.DequeueMessages().Should().Equal(
                "[Error] Expected <book xmlns=\"nsp\">, " +
                "but found: <book xmlns=\"\">");
        }
Пример #2
0
        public void Lack_Of_Mandatory_Element_Should_Log_Errors()
        {
            var reader = new AssociativeReader(_testLogger, _xmlReader,
                                               new ScopeHandler("R",
                                                                new ScopeHandler("D")
            {
                Mandatory = true,
            }));

            reader.Scan();

            _testLogger.DequeueMessages().Should()
            .Equal("[Error] Mandatory handler is not found: D");
        }
Пример #3
0
        public void T2()
        {
            var setter = A.Fake <Action <string> >();

            var schema = new SchemaBuilder(new Fb2Reader(_testLogger,
                                                         new XElement("A",
                                                                      new XElement("B", "value")).CreateReader()))

                         .AddRead("A")
                         .AddRead("C", setter);

            new SchemaRunner().Run(schema.Build());

            A.CallTo(() => setter("")).WithAnyArguments().MustNotHaveHappened();
            _testLogger.DequeueMessages().Should().Equal(
                "[Error] Expected <C>, but found: <B>");
        }