public void PartsCatalogue_GetCompatibleParts_PartsFound()
        {
            //Arrange
            string partNumber = "1234-Test";

            //Act
            List <PartSummary> result = (List <PartSummary>)_partsCatalogue.GetCompatibleParts(partNumber);

            //Assert
            Assert.IsTrue(result.Count > 0);
            _partsTraderPartsServiceMock.Verify(x => x.FindAllCompatibleParts(partNumber), Times.Once);
        }
Exemplo n.º 2
0
        public void GetCompatibleParts_CorrectPartNumberLongPartCode_Pass()
        {
            PartCatalogue partCatalogue = new PartCatalogue();

            partCatalogue.GetCompatibleParts("1234-aBcDeE12345");
            Assert.Pass();
        }
Exemplo n.º 3
0
        public void GetCompatibleParts_CorrectPartNumber_Pass()
        {
            PartCatalogue partCatalogue = new PartCatalogue();

            partCatalogue.GetCompatibleParts("1234-test");
            Assert.Pass();
        }
Exemplo n.º 4
0
        public void ShouldNotHaveItemsInDatabase()
        {
            var                       value     = 0;
            PartCatalogue             catalogue = new PartCatalogue(_service);
            IEnumerable <PartSummary> result    = catalogue.GetCompatibleParts("1234-1234abc");

            Assert.AreEqual(value, result.Count());
        }
Exemplo n.º 5
0
        public void GetCompatibleParts_PartNumberWithoutDash_ThrowsInvalidPartException()
        {
            PartCatalogue partCatalogue = new PartCatalogue();

            Assert.Throws <InvalidPartException>(() =>
            {
                partCatalogue.GetCompatibleParts("1234abcd");
            });
        }
Exemplo n.º 6
0
        public void GetCompatibleParts_PartCodeNonAlphanumeric_ThrowsInvalidPartException()
        {
            PartCatalogue partCatalogue = new PartCatalogue();

            Assert.Throws <InvalidPartException>(() =>
            {
                partCatalogue.GetCompatibleParts("abcd-a+b*");
            });
        }
Exemplo n.º 7
0
        public void GetCompatibleParts_PartIdNonDigit_ThrowsInvalidPartException()
        {
            PartCatalogue partCatalogue = new PartCatalogue();

            Assert.Throws <InvalidPartException>(() =>
            {
                partCatalogue.GetCompatibleParts("abcd-abcd");
            });
        }
Exemplo n.º 8
0
        public void GetCompatibleParts_PartCodeTooShort_ThrowsInvalidPartException()
        {
            PartCatalogue partCatalogue = new PartCatalogue();

            Assert.Throws <InvalidPartException>(() =>
            {
                partCatalogue.GetCompatibleParts("123-abc");
            });
        }
Exemplo n.º 9
0
        public void ShouldHaveItemsExclusionList()
        {
            var           value     = 0;
            PartCatalogue catalogue = new PartCatalogue(_service);

            IEnumerable <PartSummary> result = catalogue.GetCompatibleParts("1111-Invoice");

            Assert.AreEqual(value, result.Count());
        }
Exemplo n.º 10
0
        public void GetCompatibleParts_PartNumberInTheDataList_FindFourCompatibleParts()
        {
            //Arrange
            string        partNumber    = "5772-MetaDATA";
            PartCatalogue partCatalogue = new PartCatalogue();

            //Act
            IEnumerable <PartSummary> compatibleParts = partCatalogue.GetCompatibleParts(partNumber);

            //Assert
            Assert.AreEqual(4, compatibleParts.Count <PartSummary>());
        }
Exemplo n.º 11
0
        public void GetCompatibleParts_PartNumberInTheDataList_FindCompatibleParts()
        {
            //Arrange
            string        partNumber    = "5772-MetaDATA";
            PartCatalogue partCatalogue = new PartCatalogue();

            //Act
            IEnumerable <PartSummary> compatibleParts = partCatalogue.GetCompatibleParts(partNumber);
            PartSummary compatiblePart = compatibleParts.First(x => x.PartNumber == partNumber);

            //Assert
            Assert.AreEqual(partNumber, compatiblePart.PartNumber);
        }
Exemplo n.º 12
0
        public void GetCompatibleParts_PartNumberInTheExclusionListWithDifferentCase_Empty()
        {
            PartCatalogue partCatalogue = new PartCatalogue();

            Assert.IsEmpty(partCatalogue.GetCompatibleParts("1234-ABCD"));
        }