// A test to see if the right Exeptions are thrown // in the CreateTranslation method of the Translation controller. public void TestCreateTranslationThrowsErrors() { //Arrange var mockUnitOfWork = new MockUnitOfWork(); var controller = new TranslationController(mockUnitOfWork); // Act // The DataNotFoundExeption should be thrown // if the first parameter does not match any id // in the database. try { var result = controller.CreateTranslation(1, null); } // Assert catch (Exception ex) { Assert.IsInstanceOfType(ex, typeof(DataNotFoundException)); } // Act // The MissingParameterExeption should be thrown // if the method takes null as the first parameter. try { var result = controller.CreateTranslation(null, null); } catch (Exception ex) { Assert.IsInstanceOfType(ex, typeof(MissingParameterException)); } }