public void GetByIdAndTypeTest() { var expected = new User { Id = 123, Login = "******" }; MockKernel.GetMock <IRepository <User> >().Setup(ur => ur.GetById(5)).Returns(expected); var actual = MockKernel.Get <DataService>().GetByIdAndType(5, "User"); Assert.AreEqual(expected, actual); }
public void GetDataByTypeTest() { var testBooks = new List <Book> { new Book { Id = 123, Description = "Desr" } }; MockKernel.GetMock <IRepository <Book> >().Setup(br => br.GetAll()).Returns(testBooks); var actual = MockKernel.Get <DataService>().GetDataByType("Book"); Assert.AreEqual(testBooks, actual); }
public void DeleteDataByTypeAndId() { MockKernel.Get <DataService>().DeleteDataByTypeAndId("Book", 8); MockKernel.GetMock <IRepository <Book> >().Verify(br => br.Delete(8)); }
public void Initialize() { MockKernel.GetMock <IRepository <Book> >().ResetCalls(); MockKernel.GetMock <IRepository <User> >().ResetCalls(); }