public ActionResult ReturnBook(string id) { BookTranscationTable bookTranscationTable = new BookTranscationTable(db); IEnumerable <BookTranscation> edittranscations = bookTranscationTable.GetBookTransactionsByBookId(Convert.ToInt32(id), true); return(View(edittranscations)); }
public void GetBookTransactionsByBookId_ExpectedException() { Mock <IDatabase> mock = new Mock <IDatabase>(); BookTranscationTable booktable = new BookTranscationTable(mock.Object); Dictionary <string, string> parameter = new Dictionary <string, string>(); List <Dictionary <string, string> > result = new List <Dictionary <string, string> >(); parameter.Add("new", "test"); result.Add(parameter); mock.Setup(x => x.Query(It.IsAny <string>(), It.IsAny <Dictionary <string, object> >())).Returns(result); Assert.IsInstanceOfType(booktable.GetBookTransactionsByBookId(1, true), typeof(List <BookTranscation>)); }
public void GetBookTransactionsByBookId() { Mock <IDatabase> mock = new Mock <IDatabase>(); BookTranscationTable booktable = new BookTranscationTable(mock.Object); Dictionary <string, string> parameter = new Dictionary <string, string>(); List <Dictionary <string, string> > result = new List <Dictionary <string, string> >(); parameter.Add("Transcation_ID", "20"); parameter.Add("Book_ID", "4080"); parameter.Add("BookStatus", "Renewed"); parameter.Add("Member_ID", "10"); parameter.Add("Due_Date", "2018-07-22 17:35:23"); parameter.Add("Date_of_issue", "2018-07-22 17:35:23"); result.Add(parameter); mock.Setup(x => x.Query(It.IsAny <string>(), It.IsAny <Dictionary <string, object> >())).Returns(result); Assert.IsInstanceOfType(booktable.GetBookTransactionsByBookId(1, true), typeof(List <BookTranscation>)); }