Esempio n. 1
0
        public void DeletePhoneNumber_Action_Fails()
        {
            // Arrange
            var phoneNumberDto = TestHelper.PhoneNumberDto();

            GenericServiceResponse <bool> fakeResponse = null;

            mockClientServicesProvider.Setup(x => x.Logger).Returns(mockLogger.Object).Verifiable();
            mockClientServicesProvider.Setup(x => x.PhoneNumberService.DeletePhoneNumber(phoneNumberDto)).Returns(fakeResponse).Verifiable();

            var viewModel = new GenericViewModel();

            var action = new DeletePhoneNumber <GenericViewModel>(mockClientServicesProvider.Object)
            {
                OnComplete = model => viewModel = model
            };

            // Act
            var result = action.Invoke(phoneNumberDto);

            // Assert
            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(GenericViewModel));
            Assert.IsNotNull(result.Notifications);
            Assert.IsInstanceOfType(result.Notifications, typeof(NotificationCollection));
            Assert.IsTrue(result.Notifications.Count() == 1);
            Assert.IsTrue(result.HasErrors);
            Assert.IsNotNull(result.Success);
            Assert.IsInstanceOfType(result.Success, typeof(bool));
            Assert.IsFalse(result.Success);
        }
Esempio n. 2
0
        public async Task <object> Delete(DeletePhoneNumber request)
        {
            var result = await _iContactDetailBusinessService.DeletePhoneNumberByID(request.ID);

            return(result);
        }