public void GetByFilter_ShouldHandleNullPagingInfo() { // Set up Prerequisites var uow = _kernel.GetMock <IUnitOfWork>(); uow.Setup(e => e.Repository <BeerDataObject, IBeerDataObjectRepository>()).Returns(new MockBeerDataObjectRepository(null)); var bm = _kernel.Get <IBeerDataObjectBussinessManger>(); BeersController bc = new BeersController(bm); try { // Act var r = bc.GetByFilter(null).Result; // Assert Assert.IsNotNull(r); } catch (Exception) { throw new AssertFailedException( String.Format("null pointer exception not handeled") ); } }
public void GetByFilter_ShouldReturnAllBeers() { // Set up Prerequisites var uow = _kernel.GetMock <IUnitOfWork>(); uow.Setup(e => e.Repository <BeerDataObject, IBeerDataObjectRepository>()).Returns(new MockBeerDataObjectRepository(null)); var bm = _kernel.Get <IBeerDataObjectBussinessManger>(); BeersController bc = new BeersController(bm); // Act var r = bc.GetByFilter(new PagingInfo() { Order = "", Sort = "", Page = "1" }).Result; // Assert Assert.AreEqual(r.BeerDataObjectListVM.Count, 1); }