public async Task ICommand_ExecuteAsync_InvalidReferenceTypeParameter_Test() { //Arrange InvalidCommandParameterException actualInvalidCommandParameterException = null; InvalidCommandParameterException expectedInvalidCommandParameterException = new InvalidCommandParameterException(typeof(int), typeof(string)); ICommand command = new AsyncCommand <int>(IntParameterTask); //Act try { command.Execute("Hello World"); await NoParameterTask(); await NoParameterTask(); } catch (InvalidCommandParameterException e) { actualInvalidCommandParameterException = e; } //Assert Assert.IsNotNull(actualInvalidCommandParameterException); Assert.AreEqual(expectedInvalidCommandParameterException.Message, actualInvalidCommandParameterException.Message); }
public async Task ICommand_ExecuteAsync_ValueTypeParameter_Test() { //Arrange InvalidCommandParameterException?actualInvalidCommandParameterException = null; InvalidCommandParameterException expectedInvalidCommandParameterException = new InvalidCommandParameterException(typeof(int)); ICommand command = new AsyncValueCommand <int>(IntParameterTask); //Act try { command.Execute(null); await NoParameterTask(); await NoParameterTask(); } catch (InvalidCommandParameterException e) { actualInvalidCommandParameterException = e; } //Assert Assert.IsNotNull(actualInvalidCommandParameterException); Assert.AreEqual(expectedInvalidCommandParameterException.Message, actualInvalidCommandParameterException?.Message); }
public void ICommand_ExecuteAsync_ValueTypeParameter_Test() { // Arrange InvalidCommandParameterException?actualInvalidCommandParameterException = null; var expectedInvalidCommandParameterException = new InvalidCommandParameterException(typeof(int)); ICommand command = new AsyncCommand <int>(IntParameterTask); // Act actualInvalidCommandParameterException = Assert.Throws <InvalidCommandParameterException>(() => command.Execute(null)); // Assert Assert.IsNotNull(actualInvalidCommandParameterException); Assert.AreEqual(expectedInvalidCommandParameterException.Message, actualInvalidCommandParameterException?.Message); }
public void ICommand_ExecuteAsync_InvalidReferenceTypeParameter_Test() { // Arrange InvalidCommandParameterException actualInvalidCommandParameterException = null; var expectedInvalidCommandParameterException = new InvalidCommandParameterException(typeof(int), typeof(string)); ICommand command = new AsyncCommand <int>(IntParameterTask); // Act actualInvalidCommandParameterException = Assert.Throws <InvalidCommandParameterException>(() => command.Execute("Hello World")); // Assert Assert.NotNull(actualInvalidCommandParameterException); Assert.Equal(expectedInvalidCommandParameterException.Message, actualInvalidCommandParameterException?.Message); }
public void ICommand_ExecuteAsync_InvalidValueTypeParameter_Test() { // Arrange InvalidCommandParameterException actualInvalidCommandParameterException = null; var expectedInvalidCommandParameterException = new InvalidCommandParameterException(typeof(string), typeof(int)); ICommand command = new AsyncCommand <string>(StringParameterTask); // Act actualInvalidCommandParameterException = Assert.Throws <InvalidCommandParameterException>(() => command.Execute(Delay)); // Assert Assert.NotNull(actualInvalidCommandParameterException); Assert.Equal(expectedInvalidCommandParameterException.Message, actualInvalidCommandParameterException?.Message); }
public async Task AsyncCommand_ExecuteAsync_InvalidValueTypeParameter_Test() { //Arrange InvalidCommandParameterException actualInvalidCommandParameterException = null; InvalidCommandParameterException expectedInvalidCommandParameterException = new InvalidCommandParameterException(typeof(string), typeof(int)); AsyncCommand <string> command = new AsyncCommand <string>(StringParameterTask); //Act try { await command.ExecuteAsync(500); } catch (InvalidCommandParameterException e) { actualInvalidCommandParameterException = e; } //Assert Assert.IsNotNull(actualInvalidCommandParameterException); Assert.AreEqual(expectedInvalidCommandParameterException.Message, actualInvalidCommandParameterException.Message); }
public async Task ICommand_Execute_InvalidValueTypeParameter_Test() { // Arrange InvalidCommandParameterException actualInvalidCommandParameterException = null; var expectedInvalidCommandParameterException = new InvalidCommandParameterException(typeof(string), typeof(int)); ICommand command = new AsyncValueCommand <string>(StringParameterTask); // Act try { command.Execute(Delay); await NoParameterTask(); await NoParameterTask(); } catch (InvalidCommandParameterException e) { actualInvalidCommandParameterException = e; } // Assert Assert.NotNull(actualInvalidCommandParameterException); Assert.Equal(expectedInvalidCommandParameterException.Message, actualInvalidCommandParameterException?.Message); }