public void ThrowArgumentException_WhenInvokedWithEmptyParametersCollection() { // Arrange var sportscardFactoryMock = new Mock <ISportscardFactory>(); var companyServiceMock = new Mock <ICompanyService>(); var companyName = "Progress"; var expectedMessage = $"Company \"{companyName}\" was deleted from database."; var deleteCompanyCommand = new DeleteCompanyCommand(sportscardFactoryMock.Object, companyServiceMock.Object); var parameters = new List <string>(); //Act && Assert Assert.ThrowsException <ArgumentException>(() => deleteCompanyCommand.Execute(parameters)); }
public void CallCompanyDeleteMethodOnce_WhenInvokedWithValidParameters() { // Arrange var sportscardFactoryMock = new Mock <ISportscardFactory>(); var companyServiceMock = new Mock <ICompanyService>(); var companyName = "Progress"; var deleteCompanyCommand = new DeleteCompanyCommand(sportscardFactoryMock.Object, companyServiceMock.Object); var parameters = new List <string>() { companyName }; //Act deleteCompanyCommand.Execute(parameters); //Assert companyServiceMock.Verify(x => x.DeleteCompany(companyName), Times.Once); }
public void ReturnSuccessMessage_WhenInvokedWithValidParameters() { // Arrange var sportscardFactoryMock = new Mock <ISportscardFactory>(); var companyServiceMock = new Mock <ICompanyService>(); var companyName = "Progress"; var expectedMessage = $"Company \"{companyName}\" was deleted from database."; var deleteCompanyCommand = new DeleteCompanyCommand(sportscardFactoryMock.Object, companyServiceMock.Object); var parameters = new List <string>() { companyName }; //Act var actualMessage = deleteCompanyCommand.Execute(parameters); //Assert Assert.AreEqual(expectedMessage, actualMessage); }