public void XMLPopulate_PassingInDuplicateIsbn_ShouldBeRegected_AndMessageIsDisplayed_Test()
        {
            // Arrange
            var isbn  = "2423434";
            var type  = "DVD";
            var title = "movie";

            string[,] data = new string[2, 3] {
                { isbn, type, title },
                { isbn, type, title }
            };

            var document = CreateXML(data);
            var readXML  = new PopulateCatalogue();

            var expectedMessage = "An item with the same key has already been added.";

            // Act
            Action act = () => readXML.GetItemsFromXmlDocument(document); // called

            // Assert
            var exception = Assert.ThrowsException <ArgumentException>(act);

            //Assert.AreEqual(expectedMessage, exception.Message);

            // Fluent Assertion
            act.Should().Throw <ArgumentException>()
            .And
            .Message.Should().Be(expectedMessage);
        }
        public void XMLPopulate_PassingInValidTypeUpperCase_ShouldBeAccepted_Test()
        {
            // Arrange
            var isbn  = "2423434";
            var type  = "MAGAZINE";
            var title = "magazine";

            // Act
            var readXML = new PopulateCatalogue();
            var catalog = readXML.GetItemsFromXmlDocument(CreateXML(isbn, type, title));

            // Assert
            Assert.AreEqual(1, catalog.Count);
        }
        public void XMLPopulate_PassingInInvalidType_ShouldNotBeAccepted_Test()
        {
            // Arrange
            var isbn  = "2423434";
            var type  = "invalidType";
            var title = "invalid";

            // Act
            var readXML = new PopulateCatalogue();
            var catalog = readXML.GetItemsFromXmlDocument(CreateXML(isbn, type, title));

            // Assert
            Assert.AreEqual(0, catalog.Count);
        }
        public void XMLPopulate_TypeNewReleaseBook_ExpectedToBeAccepted_Test()
        {
            // Arrange
            var isbn  = "2423434";
            var type  = "NewReleaseBook";
            var title = "newRelease";

            // Act
            var readXML = new PopulateCatalogue();
            var catalog = readXML.GetItemsFromXmlDocument(CreateXML(isbn, type, title));

            // Assert
            Assert.AreEqual(1, catalog.Count);
        }
        public void XMLPopulate_AddingOneNode_ReturnsOneDictionaryItem_Test()
        {
            // Arrange
            var isbn  = "2423434";
            var type  = "DVD";
            var title = "movie";

            // Act
            var readXML = new PopulateCatalogue();
            var catalog = readXML.GetItemsFromXmlDocument(CreateXML(isbn, type, title));

            // Assert
            //Assert.AreEqual(1, catalog.Count); // items in catalog

            // Fluet Assertion
            catalog.Count.Should().Be(1);
        }
        public void XMLPopulate_PassingInIsbnMixedCase_ShouldBeAccepted_Test()
        {
            // Arrange
            var isbn  = "abc123";
            var type  = "dvd";
            var title = "magazine";

            // Act
            var readXML = new PopulateCatalogue();
            var catalog = readXML.GetItemsFromXmlDocument(CreateXML(isbn, type, title));

            // Assert
            //Assert.AreEqual(1, catalog.Count);
            //Assert.AreEqual(isbn.ToUpper(), catalog.First().Key);

            // Fluent Assertion
            catalog.Count.Should().Be(1);
            catalog.First().Key.Should().Be(isbn.ToUpper());
        }
        public void XMLPopulate_PassedInValues_ShouldPersist_Test()
        {
            // Arrange
            var isbn  = "2423434";
            var type  = "DVD";
            var title = "movie";

            // Act
            var readXML = new PopulateCatalogue();
            var catalog = readXML.GetItemsFromXmlDocument(CreateXML(isbn, type, title));

            // Assert
            //Assert.AreEqual(isbn, catalog.First().Key);
            //Assert.AreEqual(title, catalog.First().Value.Title);

            // Fluent Assertion
            catalog.First().Key.Should().Be(isbn);
            catalog.First().Value.Title.Should().Be(title);
        }
        public void XMLPopulate_GettingIsbnMixedCase_ShouldBeAccepted_Test()
        {
            // Arrange
            var isbn  = "abc123";
            var type  = "dvd";
            var title = "magazine";

            // Act
            var readXML = new PopulateCatalogue();
            var catalog = readXML.GetItemsFromXmlDocument(CreateXML(isbn, type, title));

            // Assert
            Assert.AreEqual(1, catalog.Count);

            var item = catalog[isbn];

            //Assert.IsNotNull(item);
            //Assert.AreEqual(title, item.Title);

            // Fluent Assertion
            item.Should().NotBeNull();
            item.Title.Should().Equals(title);
        }