Example #1
0
        public void DeleteShouldReturnTrueIfRepositoryThrowsNoExceptions()
        {
            // Arrange
            var mock   = new Mock <IDeliveryPersonRepository>();
            var mockId = Guid.NewGuid();

            Repository = mock.Object;
            Service    = new DeliveryPersonService(Repository);

            // Act
            var result = Service.Delete(mockId);

            // Assert
            Assert.IsTrue(result);
        }
Example #2
0
        public void DeleteShouldReturnFalseIfRepositoryThrowsExceptions()
        {
            // Arrange
            var mock   = new Mock <IDeliveryPersonRepository>();
            var mockId = Guid.NewGuid();

            mock.Setup(_ => _.DeleteDeliveryPersonById(mockId))
            .Throws <Exception>();
            Repository = mock.Object;
            Service    = new DeliveryPersonService(Repository);

            // Act
            var result = Service.Delete(mockId);

            // Assert
            Assert.IsFalse(result);
        }