public void Constructor_PassNullFetchAll_ThrowsException() { //Arrange var fetch = new Mock <Func <int, ITestObject> >().Object; //Act var mapping = new ReadOnlyPicnicCacheMapping <int, ITestObject>(fetch, null); }
public void FetchAll_AllScenarios_FuncIsCalled() { //Arrange bool fetchCalled = false; bool fetchAllCalled = false; Func <int, ITestObject> fetch = x => { fetchCalled = true; return(new Mock <ITestObject>().Object); }; Func <IEnumerable <ITestObject> > fetchAll = () => { fetchAllCalled = true; return(new Mock <IEnumerable <ITestObject> >().Object); }; var mapping = new ReadOnlyPicnicCacheMapping <int, ITestObject>(fetch, fetchAll); //Act var result = mapping.FetchAll(); //Assert Assert.IsTrue(fetchAllCalled); Assert.IsFalse(fetchCalled); }