public void AddContactDischargeNote_Failure() { Mock <IContactDischargeNoteRuleEngine> mock = new Mock <IContactDischargeNoteRuleEngine>(); contactDischargeNoteRuleEngine = mock.Object; ContactDischargeNoteController contactDischargeNoteController = new ContactDischargeNoteController(contactDischargeNoteRuleEngine); //Act var addContactDischargeNote = new ContactDischargeNoteModel { ContactDischargeNoteID = 0, ContactID = 0, ContactAdmissionID = null, DischargeReasonID = 1, NoteTypeID = 5, DischargeDate = DateTime.Now, NoteText = "Fail Test case for adding new Note", ForceRollback = true }; var addResult = contactDischargeNoteController.AddContactDischargeNote(addContactDischargeNote); var response = addResult as HttpResult <Response <ContactDischargeNoteModel> >; //Assert Assert.IsNotNull(response, "Response can't be null"); Assert.IsTrue(response.Value.ResultCode != 0); Assert.IsTrue(response.Value.RowAffected == 0); }
/// <summary> /// Initializes a new instance of the <see cref="ContactController" /> class. /// </summary> /// <param name="contactRuleEngine">The contact rule engine.</param> public ContactDischargeNoteController(IContactDischargeNoteRuleEngine contactDischargeNoteRuleEngine) { this.contactDischargeNoteRuleEngine = contactDischargeNoteRuleEngine; }