public void ItShouldReturnPadLeftParamIfIsValid(string productNumber, string customerId, int customerFieldLength, int productFieldLength, string expectedCustomer, string expectedProduct) { //Arrange CustomerProduct customerProduct = new CustomerProduct { ProductNumber = productNumber }; Customer customer = new Customer { CustomerID = customerId }; CustomerRequest request = new CustomerRequest { CustomerProduct = customerProduct, Customer = customer, customerIDFieldLength = customerFieldLength, productFieldLength = productFieldLength }; WithCodeSmells wcs = new WithCodeSmells(); //Act wcs.ValidateRequest(request); //Assert Assert.AreEqual(expectedCustomer, request.Customer.CustomerID); Assert.AreEqual(expectedProduct, request.CustomerProduct.ProductNumber); }
public void ItShouldReturnExceptionIfAnyParamIsInvalid(string productNumber, string customerId, int customerFiedLength, int productFieldLength, string exception) { //Arrange CustomerProduct customerProduct = new CustomerProduct { ProductNumber = productNumber }; Customer customer = new Customer { CustomerID = customerId }; CustomerRequest request = new CustomerRequest { CustomerProduct = customerProduct, Customer = customer, customerIDFieldLength = customerFiedLength, productFieldLength = productFieldLength }; WithCodeSmells wcs = new WithCodeSmells(); //Assert Exception ex = Assert.Throws <Exception>(() => wcs.ValidateRequest(request)); Assert.That(ex.Message, Is.EqualTo(exception)); }