Пример #1
0
        static void Main()
        {
            string fileLocation           = "books.xml";
            GetAllBooksCommandFactory fac = new GetAllBooksCommandFactory(
                fileLocation, new XmlDocument());

            GetAllBooksCommand cmd  = fac.GetCommand();
            List <Book>        list = cmd.ExecuteGetAllBooks();
        }
Пример #2
0
        public void GetAllBooksCommandFactory_Returns_Type_GetAllBooksCommand()
        {
            //arrange
            string             testFileName    = It.IsAny <string>();
            Mock <XmlDocument> mockXMLDocument = new Mock <XmlDocument>();

            //act
            GetAllBooksCommandFactory fac = new GetAllBooksCommandFactory(testFileName, mockXMLDocument.Object);
            var actual = fac.GetCommand();

            //assert
            Assert.IsInstanceOf <GetAllBooksCommand>(actual);
        }
Пример #3
0
        public void GetAllBooksCommandFactory_Loads_XMLDocument_Using_FilePath()
        {
            //arrange
            string             testFileName    = It.IsAny <string>();
            Mock <XmlDocument> mockXMLDocument = new Mock <XmlDocument>();

            mockXMLDocument.Setup(d => d.Load(testFileName));

            //act
            GetAllBooksCommandFactory fac = new GetAllBooksCommandFactory(testFileName,
                                                                          mockXMLDocument.Object);
            var actual = fac.GetCommand();

            //assert
            mockXMLDocument.Verify(d => d.Load(testFileName), Times.Once());
        }