public void ThrowArgumentException_WhenInvokedWithEmptyParametersCollection() { // Arrange var sportscardFactoryMock = new Mock <ISportscardFactory>(); var sportshallServiceMock = new Mock <ISportshallService>(); var sportshallName = "Topfit"; var expectedMessage = $"Sportshall \"{sportshallName}\" was deleted from database."; var deleteSportshallCommand = new DeleteSportshallCommand(sportscardFactoryMock.Object, sportshallServiceMock.Object); var parameters = new List <string>(); //Act && Assert Assert.ThrowsException <ArgumentException>(() => deleteSportshallCommand.Execute(parameters)); }
public void CallSportshallDeleteMethodOnce_WhenInvokedWithValidParameters() { // Arrange var sportscardFactoryMock = new Mock <ISportscardFactory>(); var sportshallServiceMock = new Mock <ISportshallService>(); var sportshallName = "Topfit"; var deleteSportshallCommand = new DeleteSportshallCommand(sportscardFactoryMock.Object, sportshallServiceMock.Object); var parameters = new List <string>() { sportshallName }; //Act deleteSportshallCommand.Execute(parameters); //Assert sportshallServiceMock.Verify(x => x.DeleteSportshall(sportshallName), Times.Once); }
public void ReturnSuccessMessage_WhenInvokedWithValidParameters() { // Arrange var sportscardFactoryMock = new Mock <ISportscardFactory>(); var sportshallServiceMock = new Mock <ISportshallService>(); var sportshallName = "Topfit"; var expectedMessage = $"Sportshall \"{sportshallName}\" was deleted from database."; var deleteSportshallCommand = new DeleteSportshallCommand(sportscardFactoryMock.Object, sportshallServiceMock.Object); var parameters = new List <string>() { sportshallName }; //Act var actualMessage = deleteSportshallCommand.Execute(parameters); //Assert Assert.AreEqual(expectedMessage, actualMessage); }