public void ShouldReturnCachedList() { var siteMock = new ShimSPSite(); const string TestUrl = "test/url"; var listMock = new ShimSPList(); var listCollection = new ShimSPListCollection { ItemGetGuid = _ => listMock }; var webMock = new ShimSPWeb { ServerRelativeUrlGet = () => TestUrl, ListsGet = () => listCollection }; siteMock.OpenWebGuid = guid => webMock; using (var cache = SaveDataJobExecuteCache.InitializeCache(siteMock)) { var properties = new ShimSPItemEventProperties { RelativeWebUrlGet = () => TestUrl }; var webById = cache.GetWeb(Guid.Empty.ToString()); var list = SaveDataJobExecuteCache.GetList(properties); webById.ShouldNotBeNull(); list.ShouldBe(listMock); } }
public void ShouldReturnListFromPropertiesIfNoCache() { var listMock = new ShimSPList(); var properties = new ShimSPItemEventProperties { ListGet = () => listMock }; var list = SaveDataJobExecuteCache.GetList(properties); list.ShouldBe(listMock); }
public void ShouldReturnListFromPropertiesIfItIsNotFoundInCache() { var siteMock = new ShimSPSite(); const string TestUrl = "test/url"; var listMock = new ShimSPList(); using (SaveDataJobExecuteCache.InitializeCache(siteMock)) { var properties = new ShimSPItemEventProperties { RelativeWebUrlGet = () => TestUrl, ListGet = () => listMock }; var list = SaveDataJobExecuteCache.GetList(properties); list.ShouldBe(listMock); } }