Esempio n. 1
0
        public void Delete_IdExisting_ReturnsDeletedProductMetricWithSpecifiedId()
        {
            //Arrange
            int           existingId = 12;
            ProductMetric expected   = new ProductMetric
            {
                Id      = existingId,
                Name    = "Oversized Hoodie",
                MetricX = "",
                MetricY = "Length",
                MetricZ = "Sleeve Length"
            };

            Mock <IProductMetricRepository> productMetricRepository = new Mock <IProductMetricRepository>();

            productMetricRepository.Setup(repo => repo.Delete(existingId)).
            Returns(expected);

            IProductMetricService productMetricService = new ProductMetricService(productMetricRepository.Object);

            //Act
            ProductMetric actual = productMetricService.Delete(existingId);

            //Assert
            Assert.Equal(expected, actual);
        }
Esempio n. 2
0
        public void Delete_IdNonExisting_ReturnsNull()
        {
            //Arrange
            int           existingId = 12;
            ProductMetric expected   = null;

            Mock <IProductMetricRepository> productMetricRepository = new Mock <IProductMetricRepository>();

            productMetricRepository.Setup(repo => repo.Delete(existingId)).
            Returns(expected);

            IProductMetricService productMetricService = new ProductMetricService(productMetricRepository.Object);

            //Act
            ProductMetric actual = productMetricService.Delete(existingId);

            //Assert
            Assert.Equal(expected, actual);
        }