コード例 #1
0
        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);
            }
        }
コード例 #2
0
        public void ShouldReturnListFromPropertiesIfNoCache()
        {
            var listMock = new ShimSPList();

            var properties = new ShimSPItemEventProperties {
                ListGet = () => listMock
            };
            var list = SaveDataJobExecuteCache.GetList(properties);

            list.ShouldBe(listMock);
        }
コード例 #3
0
        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);
            }
        }