public void SaveDocumentInsert_FailDeliverableIDDoesNotExist() { bool exceptionCaught = false; string errorMsg = string.Empty; string deliverableIdPartialErrorMsg = "Deliverable Id"; //Arrange DocumentUploadViewModel testDocViewModel = new DocumentUploadViewModel() { FileExtension = "1234567890123456789012345", // > 25 chars DocumentAccessTypeId = 1 //DEPT }; //Act try { var docManager = new DocumentsManager(mockDocumentService.Object, mockUserService.Object, mockDropDownListService.Object); docManager.Save(testDocViewModel); } catch (Exception ex) { exceptionCaught = true; errorMsg = ex.Message; } //Assert Assert.IsTrue(exceptionCaught); Assert.IsTrue(errorMsg.Contains(deliverableIdPartialErrorMsg)); }