public void CreateCustomer_Action_Fails() { // Arrange var customerDto = TestHelper.CustomerDto(); GenericServiceResponse <bool> fakeResponse = null; mockClientServicesProvider.Setup(x => x.Logger).Returns(mockLogger.Object).Verifiable(); mockClientServicesProvider.Setup(x => x.CustomerService.CreateCustomer(customerDto)).Returns(fakeResponse).Verifiable(); var viewModel = new GenericViewModel(); var action = new CreateCustomer <GenericViewModel>(mockClientServicesProvider.Object) { OnComplete = model => viewModel = model }; // Act var result = action.Invoke(customerDto); // 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); }
private void потребительToolStripMenuItem_Click(object sender, EventArgs e) { CreateCustomer?.Invoke(this, e); }