Esempio n. 1
0
        public void EditShouldReturnTrueIfRepositoryThrowsNoExceptions()
        {
            // Arrange
            var mock = new Mock <IDeliveryPersonRepository>();

            Repository = mock.Object;
            Service    = new DeliveryPersonService(Repository);
            var mockDPerson = Builder <DeliveryPersonEditModel> .CreateNew().Build();

            // Act
            var result = Service.Edit(mockDPerson);

            // Assert
            Assert.IsTrue(result);
        }
Esempio n. 2
0
        public void EditShouldReturnFalseIfRepositoryThrowsExceptions()
        {
            // Arrange
            var mock = new Mock <IDeliveryPersonRepository>();

            mock.Setup(_ => _.UpdateDeliveryPersonDetails(It.IsAny <DeliveryPerson>()))
            .Throws <Exception>();
            Repository = mock.Object;
            Service    = new DeliveryPersonService(Repository);
            var mockCustomer = Builder <DeliveryPersonEditModel> .CreateNew().Build();

            // Act
            var result = Service.Edit(mockCustomer);

            // Assert
            Assert.IsFalse(result);
        }