public void ShouldThrowInvalidInputException_WhenInvalidQuantityInputReceived() { var productsList = new OrderItemsFactory().Create(); var inputReader = new MockInputReader(standardCSVHeaders, csvBodyWithOneOrder); var orderInputValidator = new MockOrderInputValidator(); orderInputValidator.SetReturnToFalse("quantity"); var orderTaker = new CSVOrderTaker(inputReader, productsList, orderInputValidator); Action act = () => orderTaker.CreateOrder(); var exception = Assert.Throws <InvalidInputException>(act); Assert.Equal("8 is an invalid input - Quantity should be recorded in round number and within the range of 1 - 100.", exception.Message); }
public void ShouldThrowInvalidInputExceptionWithCorrectMessage_WhenInvalidCustomerNameReceived() { var productsList = new List <OrderItem>(); var inputReader = new MockInputReader(standardCSVHeaders, csvBodyWithOneOrder); var orderInputValidator = new MockOrderInputValidator(); orderInputValidator.SetReturnToFalse("name"); var orderTaker = new CSVOrderTaker(inputReader, productsList, orderInputValidator); Action act = () => orderTaker.CreateOrder(); var exception = Assert.Throws <InvalidInputException>(act); Assert.Equal("Test Name is an invalid input - Name should start with alphabet letter and with the minimal length of 3 characters.", exception.Message); }
public void ShouldThrowInvalidInputException_WhenInvalidDueDateInputReceived() { var productsList = new List <OrderItem>(); var inputReader = new MockInputReader(standardCSVHeaders, csvBodyWithOneOrder); var orderInputValidator = new MockOrderInputValidator(); orderInputValidator.SetReturnToFalse("dueDate"); var orderTaker = new CSVOrderTaker(inputReader, productsList, orderInputValidator); Action act = () => orderTaker.CreateOrder(); var exception = Assert.Throws <InvalidInputException>(act); Assert.Equal("19-Jan-21 is an invalid input - Date could not be in the past and should be in DD-MMM-YY format.", exception.Message); }