public void Post_InValidSize_Error() { //Arrange var controller = new RegexUrlProcessController(new RegexUrlValidation(), new SizeValidation()); //Act var inputObjects = new List <InputObject> { new InputObject() { Url = "https://www.google.com/", Path = "google", Size = 0 }, }; var exceptionThrown = false; try { var result = (Dictionary <string, PathValueObject>)controller.Post(inputObjects).Value; } catch (Exception e) { exceptionThrown = true; Assert.AreEqual("Size - 0 is Invalid for Url - https://www.google.com/, Path - google, Size - 0", e.Message); } if (!exceptionThrown) { throw new AssertFailedException("Exception expected!!"); } }
public void Post_ValidRequest_HappyPath() { //Arrange var controller = new RegexUrlProcessController(new RegexUrlValidation(), new SizeValidation()); //Act var inputObjects = new List <InputObject> { new InputObject() { Url = "https://www.youtube.com/", Path = "youtube", Size = 20 }, new InputObject() { Url = "https://www.google.com/", Path = "google", Size = 20 }, }; var result = (Dictionary <string, PathValueObject>)controller.Post(inputObjects).Value; //Assert CollectionAssert.AllItemsAreNotNull(result); }