示例#1
0
        public void BuildData2_TaskCenterNotFoundMyTasksNotFound_ReturnsString()
        {
            // Arrange
            _siteList = new ShimSPListCollection()
            {
                ItemGetString = itemName =>
                {
                    switch (itemName)
                    {
                    case "Project Center":
                        return(new ShimSPList());

                    case "Task Center":
                        throw new Exception();

                    case "My Tasks":
                        throw new Exception();

                    default:
                        break;
                    }

                    return(null);
                }
            };

            // Act
            _testEntity.buildData2();

            // Assert
        }
 private void SetupVariables()
 {
     guid   = new Guid(GuidString);
     spList = new ShimSPList()
     {
         FieldsGet = () => new ShimSPFieldCollection(),
         ItemsGet  = () => new ShimSPListItemCollection()
     };
     spListItem = new ShimSPListItem()
     {
         IDGet       = () => DummyNumber,
         UniqueIdGet = () => guid
     };
     spListCollection = new ShimSPListCollection()
     {
         ItemGetString = _ => spList
     };
     spSite = new ShimSPSite()
     {
         IDGet = () => guid
     };
     spWeb = new ShimSPWeb()
     {
         ListsGet       = () => spListCollection,
         UrlGet         = () => DummyString,
         SiteGet        = () => spSite,
         CurrentUserGet = () => new ShimSPUser()
         {
             RegionalSettingsGet = () => null
         }
     };
 }
示例#3
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);
            }
        }
示例#4
0
        public void BuildData_TaskCenterNotFoundMyTasksNotFound_ReturnsString()
        {
            // Arrange
            _siteList = new ShimSPListCollection()
            {
                ItemGetString = itemName =>
                {
                    switch (itemName)
                    {
                    case "Project Center":
                        return(new ShimSPList());

                    case "Task Center":
                        throw new Exception();

                    case "My Tasks":
                        throw new Exception();

                    default:
                        break;
                    }

                    return(null);
                }
            };

            // Act
            var actualResult = _testEntity.buildData(true, true, true);

            // Assert
            actualResult.ShouldBe("No Tasks List Found");
        }
示例#5
0
        public void BuildData2_TaskCenterNotFound_ReturnsString()
        {
            // Arrange
            _siteList = new ShimSPListCollection()
            {
                ItemGetString = itemName =>
                {
                    switch (itemName)
                    {
                    case "Project Center":
                        return(new ShimSPList());

                    case "Task Center":
                        throw new Exception();

                    case "My Tasks":
                        return(new ShimSPList());

                    default:
                        break;
                    }

                    return(null);
                }
            };

            // Act
            var actualResult = _testEntity.buildData2();

            // Assert
            actualResult.ShouldBe("In order to take advantage of the new EPM Live functionality, please follow the instructions located <a href=\"http://www.projectpublisher.com/downloads/ProjectPublisherUpdateProcess.pdf\" target=\"_blank\">here</a>.");
        }
示例#6
0
        public void ShouldReloadListItemOnRequest()
        {
            var       webId  = Guid.NewGuid();
            var       listId = Guid.NewGuid();
            const int ItemId = 1;

            var siteMock = new ShimSPSite();

            var listItemMock = new ShimSPListItem {
                IDGet = () => ItemId
            };
            var listItemMockNew = new ShimSPListItem {
                IDGet = () => ItemId
            };
            var listItemCollection = new ShimSPListItemCollection {
                GetEnumerator = () => Enumerable.Repeat <SPListItem>(listItemMock, 1).GetEnumerator()
            };
            var listMock = new ShimSPList
            {
                GetItemsSPQuery = _ => listItemCollection, IDGet = () => listId, GetItemByIdInt32 = _ => listItemMockNew
            };
            var listCollection = new ShimSPListCollection {
                ItemGetGuid = _ => listMock
            };

            const string TestUrl = "test/url";
            var          webMock = new ShimSPWeb {
                ServerRelativeUrlGet = () => TestUrl, ListsGet = () => listCollection
            };

            siteMock.OpenWebGuid = guid => webMock;

            using (var cache = SaveDataJobExecuteCache.InitializeCache(siteMock))
            {
                string preloadErrors;
                var    preloadHasErrors =
                    cache.PreloadListItems(new[]
                {
                    new SaveDataJobExecuteCache.ListItemInfo
                    {
                        WebId      = webId.ToString(),
                        ListId     = listId.ToString(),
                        ListItemId = ItemId.ToString()
                    }
                }, out preloadErrors);

                preloadHasErrors.ShouldBe(false);
                preloadErrors.ShouldBe(string.Empty);

                var listItem = SaveDataJobExecuteCache.Cache.GetListItem(TestUrl, listId, ItemId, refresh: true);
                listItem.ShouldBe(listItemMockNew);

                listItem = SaveDataJobExecuteCache.Cache.GetListItem(TestUrl, listId, ItemId);
                listItem.ShouldBe(listItemMockNew);
            }
        }
 private void ShimSPListCollectionMethods()
 {
     _shimListCollection = new ShimSPListCollection
     {
         ItemGetString      = _ => _shimList,
         ItemGetGuid        = _ => _shimList,
         GetListGuidBoolean = (_, __) => _shimList,
         TryGetListString   = list => _shimList.Instance
     };
 }
        public void SetUp()
        {
            _shimsContext = ShimsContext.Create();

            _resourceUrl = "http://test.test";

            _webServerRelativeUrl = "http://test.test";

            _resourcePlanListsString = "1,2,3";
            _siteId   = Guid.NewGuid();
            _hours    = 1;
            _workdays = "1";

            _listItemShim = new ShimSPListItem
            {
                ItemGetGuid = id => new object()
            };

            var listItemCollection = new ShimSPListItemCollection();

            var webList = new ShimSPList
            {
                GetItemsSPQuery = query =>
                {
                    return(listItemCollection.Bind(new[] { _listItemShim.Instance }));
                },
                FieldsGet = () => new ShimSPFieldCollection
                {
                    GetFieldByInternalNameString = name => new ShimSPField()
                }
            };

            var webListCollectionShim = new ShimSPListCollection
            {
                ItemGetString = (name) => webList.Instance
            };

            _webShim = new ShimSPWeb
            {
                ServerRelativeUrlGet = () => _webServerRelativeUrl,
                ListsGet             = () => webListCollectionShim.Instance
            };

            ShimSPFieldLookupValue.ConstructorString = (element, name) =>
                                                       new ShimSPFieldLookupValue();

            _spFieldUserValues = new List <SPFieldUserValue>
            {
                new SPFieldUserValue(_webShim.Instance, "1"),
                new SPFieldUserValue(_webShim.Instance, "2"),
            };

            // (CC-76656, 2018-07-18) Sadly, can not shim SPFieldUserValueCollection constructor to be able to contain elements, due to SP limitations
            // Therefore, can not test ResourceInfo generation
        }
示例#9
0
        public void ShouldReturnListItemFromPropertiesIfListIsNotInCache()
        {
            var       webId   = Guid.NewGuid();
            var       listId  = Guid.NewGuid();
            var       list2Id = Guid.NewGuid();
            const int ItemId  = 1;

            var siteMock = new ShimSPSite();

            var listMock = new ShimSPList
            {
                GetItemsSPQuery = _ => new ShimSPListItemCollection {
                    GetEnumerator = () => Enumerable.Empty <SPListItem>().GetEnumerator()
                },
                IDGet = () => listId
            };
            var listCollection = new ShimSPListCollection {
                ItemGetGuid = _ => listMock
            };

            const string TestUrl = "test/url";
            var          webMock = new ShimSPWeb {
                ServerRelativeUrlGet = () => TestUrl, ListsGet = () => listCollection
            };

            siteMock.OpenWebGuid = guid => webMock;

            using (var cache = SaveDataJobExecuteCache.InitializeCache(siteMock))
            {
                string preloadErrors;
                var    preloadHasErrors = cache.PreloadListItems(new[]
                {
                    new SaveDataJobExecuteCache.ListItemInfo
                    {
                        WebId      = webId.ToString(),
                        ListId     = listId.ToString(),
                        ListItemId = ItemId.ToString()
                    }
                }, out preloadErrors);

                preloadHasErrors.ShouldBe(false);
                preloadErrors.ShouldBe(string.Empty);

                var listItemMock = new ShimSPListItem();
                var properties   = new ShimSPItemEventProperties
                {
                    RelativeWebUrlGet = () => TestUrl,
                    ListIdGet         = () => list2Id,
                    ListItemIdGet     = () => ItemId,
                    ListItemGet       = () => listItemMock
                };
                var listItem = SaveDataJobExecuteCache.GetListItem(properties);
                listItem.ShouldBe(listItemMock);
            }
        }
示例#10
0
        public void BuildData_Exception_ReturnsString()
        {
            // Arrange
            _siteList = new ShimSPListCollection()
            {
                ItemGetString = itemName => null
            };

            // Act
            var actualResult = _testEntity.buildData(true, true, true);

            // Assert
            actualResult.ShouldContain("Object reference not set to an instance of an object.");
        }
        private void PrepareSpContext()
        {
            ShimSPContext.CurrentGet          = () => new ShimSPContext();
            ShimSPContext.AllInstances.WebGet = _ => new ShimSPWeb();

            ShimSPWebCollection.AllInstances.ItemGetGuid = (_, __) => new ShimSPWeb();
            var listCollection = new ShimSPListCollection();

            ShimSPWeb.AllInstances.ListsGet       = _ => listCollection.Bind(new SPList[] { new ShimSPList() });
            ShimSPWeb.AllInstances.SiteGet        = _ => new ShimSPSite();
            ShimSPWeb.AllInstances.CurrentUserGet = _ => new ShimSPUser();
            ShimSPWeb.AllInstances.Close          = _ => { };
            ShimSPUser.AllInstances.IDGet         = _ => Id;

            ShimSPSite.ConstructorGuid                 = (_, __) => { };
            ShimSPSite.AllInstances.OpenWeb            = _ => new ShimSPWeb();
            ShimSPSite.AllInstances.OpenWebGuid        = (_, __) => new ShimSPWeb();
            ShimSPSite.AllInstances.AllWebsGet         = _ => new ShimSPWebCollection();
            ShimSPSite.AllInstances.ContentDatabaseGet = _ => new ShimSPContentDatabase();
            ShimSPSite.AllInstances.SiteIdGet          = _ => DefaultSiteId;
            ShimSPSite.AllInstances.IDGet              = _ => DefaultSiteId;
            ShimSPSite.AllInstances.Close              = _ => { };

            ShimSPListCollection.AllInstances.ItemGetString = (_, __) => new ShimSPList();
            ShimSPListCollection.AllInstances.ItemGetGuid   = (_, __) => new ShimSPList();
            ShimSPList.AllInstances.TitleGet = _ => ListTitle;
            var listItemCollection = new ShimSPListItemCollection();

            ShimSPList.AllInstances.GetItemsSPQuery = (_, __) => listItemCollection.Bind(new SPListItem[] { new ShimSPListItem() });
            var fieldCollection = new ShimSPFieldCollection();

            ShimSPList.AllInstances.FieldsGet    = _ => fieldCollection.Bind(new SPField[] { new ShimSPField() });
            ShimSPListItem.AllInstances.TitleGet = _ => DummyString;

            ShimSPFieldCollection.AllInstances.ItemGetString = (_, __) => new ShimSPField();
            ShimSPFieldCollection.AllInstances.GetFieldByInternalNameString = (_, __) => new ShimSPField();
            ShimSPFieldCollection.AllInstances.ContainsFieldString          = (_, __) => true;
            ShimSPField.AllInstances.TypeGet         = _ => SPFieldType.Text;
            ShimSPField.AllInstances.TitleGet        = _ => FieldTitle;
            ShimSPField.AllInstances.InternalNameGet = _ => Title;
            ShimSPField.AllInstances.ReorderableGet  = _ => true;

            ShimSPFieldMultiChoice.AllInstances.ChoicesGet = _ => new StringCollection {
                DummyString
            };
            ShimSPFieldLookup.AllInstances.LookupWebIdGet = _ => DefaultWebId;

            ShimSPDatabase.AllInstances.DatabaseConnectionStringGet             = _ => DummyString;
            ShimSPSecurity.RunWithElevatedPrivilegesSPSecurityCodeToRunElevated = code => code?.Invoke();
        }
示例#12
0
        private void PrepareSpContext()
        {
            ShimSPContext.CurrentGet               = () => new ShimSPContext();
            ShimSPContext.AllInstances.WebGet      = _ => new ShimSPWeb();
            ShimSPContext.AllInstances.ListItemGet = _ => new ShimSPListItem();

            ShimCoreFunctions.getLockedWebSPWeb = web => DefaultWebId;
            ShimCoreFunctions.iGetConfigSettingSPWebStringBooleanBoolean = (a, b, c, d) => string.Empty;
            ShimUtils.GetConfigWebSPWebGuid = (_, __) => new ShimSPWeb();
            var listCollection = new ShimSPListCollection();

            ShimSPWeb.AllInstances.ListsGet            = _ => listCollection.Bind(new SPList[] { new ShimSPList() });
            ShimSPWeb.AllInstances.CurrentUserGet      = _ => new ShimSPUser();
            ShimSPWeb.AllInstances.RegionalSettingsGet = _ => new ShimSPRegionalSettings();
            ShimSPWeb.AllInstances.Close = _ => { };

            ShimSPSite.ConstructorString = (_, __) =>
            {
                ShimSPSite.AllInstances.OpenWeb = x => new ShimSPWeb();
                ShimSPSite.AllInstances.Close   = x => { };
            };

            ShimSPListCollection.AllInstances.GetListGuidBoolean = (a, b, c) => new ShimSPList();
            ShimSPListCollection.AllInstances.ItemGetString      = (_, __) => new ShimSPList();
            var fieldCollection = new ShimSPFieldCollection();

            ShimSPList.AllInstances.FieldsGet = _ => fieldCollection.Bind(new SPField[] { new ShimSPField() });
            var listItemCollection = new ShimSPListItemCollection();

            ShimSPList.AllInstances.ItemsGet          = _ => listItemCollection.Bind(new SPListItem[] { new ShimSPListItem().Instance });
            ShimSPListItem.AllInstances.IDGet         = _ => Id;
            ShimSPListItem.AllInstances.TitleGet      = _ => "LITitle";
            ShimSPListItem.AllInstances.ItemGetString = (_, key) => GetListItemValue(key);

            ShimSPFieldCollection.AllInstances.GetFieldByInternalNameString = (_, __) => new ShimSPFieldLookup();
            ShimSPField.AllInstances.GetCustomPropertyString = (_, key) => key;

            ShimSPFieldLookup.AllInstances.LookupListGet = _ => DefaultListId.ToString();

            ShimSPFieldUserValue.ConstructorSPWebString = (a, b, c) => { };
            ShimSPFieldUserValue.AllInstances.UserGet   = _ => new ShimSPUser();
            ShimSPUser.AllInstances.IDGet = _ => Id;

            ShimSPFieldLookupValue.ConstructorString        = (_, __) => { };
            ShimSPFieldLookupValue.AllInstances.LookupIdGet = _ => Id;

            ShimSPRegionalSettings.AllInstances.LocaleIdGet = _ => (uint)CultureInfo.InvariantCulture.LCID;
        }
示例#13
0
        private ShimSPListCollection CreateShimSpListCollection(ShimSPFieldCollection shimFields)
        {
            _listsDictionary = new Dictionary <string, SPList>();
            var shimLists = new ShimSPListCollection();

            shimLists.ItemGetString    = listName => _listsDictionary[listName];
            shimLists.TryGetListString = listName => _listsDictionary.ContainsKey(listName)
                ? _listsDictionary[listName]
                : null;

            var shimSpList = new ShimSPList();

            shimSpList.FieldsGet = () => shimFields.Instance;
            _listsDictionary.Add("Task Center", shimSpList.Instance);

            return(shimLists);
        }
示例#14
0
 private void SetupVariables()
 {
     validations       = 0;
     publicInstance    = BindingFlags.Instance | BindingFlags.Public;
     nonPublicInstance = BindingFlags.Instance | BindingFlags.NonPublic;
     guid  = Guid.Parse(SampleGuidString1);
     spWeb = new ShimSPWeb()
     {
         IDGet    = () => guid,
         ListsGet = () => spListCollection,
         AllowUnsafeUpdatesSetBoolean = _ => { },
         AllUsersGet        = () => new ShimSPUserCollection(),
         SiteGroupsGet      = () => new ShimSPGroupCollection(),
         RoleDefinitionsGet = () => new ShimSPRoleDefinitionCollection()
     };
     spSite = new ShimSPSite()
     {
         IDGet = () => guid
     };
     spListCollection = new ShimSPListCollection()
     {
         ItemGetGuid = _ => spList
     };
     spList = new ShimSPList()
     {
         IDGet            = () => guid,
         FieldsGet        = () => spFieldCollection,
         GetItemByIdInt32 = _ => spListItem
     };
     spListItemCollection = new ShimSPListItemCollection();
     spListItem           = new ShimSPListItem()
     {
         IDGet         = () => DummyInt,
         TitleGet      = () => DummyString,
         ItemGetString = _ => DummyString
     };
     spFieldCollection = new ShimSPFieldCollection();
     spField           = new ShimSPField();
     spUser            = new ShimSPUser();
     dataReader        = new ShimSqlDataReader()
     {
         Close = () => { }
     };
 }
示例#15
0
        public void SetUp()
        {
            _shimContext = ShimsContext.Create();

            _spWebShim = new ShimSPWeb();
            _spLists   = new[] {
                new ShimSPList {
                    IDGet = () => _testList1ID
                },
                new ShimSPList {
                    IDGet = () => _testList2ID
                },
                new ShimSPList {
                    IDGet = () => _testList3ID
                },
            };

            _spListCollectionShim = new ShimSPListCollection();
            _spListCollectionShim.Bind(_spLists.Select(shim => shim.Instance));

            _spWebShim.ListsGet = () => _spListCollectionShim;
        }
示例#16
0
 private void SetupSPWeb()
 {
     isRunWithElevatedPriveleges = false;
     ShimSPSecurity.RunWithElevatedPrivilegesSPSecurityCodeToRunElevated = action =>
     {
         isRunWithElevatedPriveleges = true;
     };
     _spLists = new[] {
         new ShimSPList {
             IDGet = () => Guid.NewGuid()
         }
     };
     _spListCollectionShim = new ShimSPListCollection()
     {
         TryGetListString = _ => null,
         ItemGetString    = name => new ShimSPList
         {
             FieldsGet = () =>
             {
                 var list = new List <SPField>
                 {
                     new ShimSPField()
                     {
                         HiddenGet       = () => false,
                         InternalNameGet = () => DummyString
                     }
                 };
                 return(new ShimSPFieldCollection().Bind(list));
             }
         }
     };
     _spListCollectionShim.Bind(_spLists.Select(shim => shim.Instance));
     spWeb = new ShimSPWeb
     {
         IDGet = () => DummyGuid,
         ServerRelativeUrlGet = () => DummyUrl,
         ListsGet             = () => _spListCollectionShim,
         SiteGet = () => new ShimSPSite
         {
             IDGet = () => DummyGuid
         },
         SiteGroupsGet           = () => null,
         AssociatedOwnerGroupGet = () => null,
         RolesGet      = () => null,
         AllUsersGet   = () => new ShimSPUserCollection {
         },
         WebsGet       = () => new ShimSPWebCollection {
         },
         NavigationGet = () => new ShimSPNavigation
         {
             TopNavigationBarGet = () => null
         },
         AllowUnsafeUpdatesGet = () => false,
         CurrentUserGet        = () => { return(new ShimSPUser()
             {
                 IDGet = () => { return DummyUserId; }
             }); }
     };
     ShimSPSite.AllInstances.OpenWeb = instance => spWeb;
     ShimSPWebCollection.AllInstances.AddStringStringStringUInt32StringBooleanBoolean = (a, b, c, d, e, f, g, h) => spWeb;
 }
        private void SetupShim()
        {
            const int fieldsCount               = 1;
            var       shimSqlDataReader         = new ShimSqlDataReader();
            var       parameterList             = new List <SqlParameter>();
            var       sqlCommandCtorCommandText = string.Empty;

            readMethodSwitcher = true;
            getListsAndFields  = false;
            settingSaved       = false;
            _spLists           = new[] {
                new ShimSPList {
                    IDGet = () => Guid.NewGuid()
                }
            };
            _spListCollectionShim = new ShimSPListCollection()
            {
                TryGetListString = _ => new ShimSPList {
                },
                ItemGetString    = name => new ShimSPList
                {
                    FieldsGet = () =>
                    {
                        var list = new List <SPField>
                        {
                            new ShimSPField()
                            {
                                HiddenGet       = () => false,
                                InternalNameGet = () => DummyString
                            }
                        };
                        return(new ShimSPFieldCollection().Bind(list));
                    }
                }
            };
            _spListCollectionShim.Bind(_spLists.Select(shim => shim.Instance));
            SPWeb spWeb = new ShimSPWeb
            {
                IDGet = () => DummyGuid,
                ServerRelativeUrlGet = () => DummyUrl,
                ListsGet             = () => _spListCollectionShim,
                SiteGet = () => new ShimSPSite
                {
                    IDGet = () => DummyGuid
                }
            };

            _privateObj.SetFieldOrProperty(Web, spWeb);
            ShimSPContext.CurrentGet = () => new ShimSPContext
            {
                WebGet = () => spWeb
            };
            ShimCoreFunctions.getLockedWebSPWeb = a =>
            {
                adminPanelVisible = true;
                return(DummyGuid);
            };
            ShimCoreFunctions.setConfigSettingSPWebStringString = (_, __, ___) => settingSaved = true;
            ShimExtensionMethods.DecompressString         = _ => KeyVal;
            ShimCoreFunctions.getConfigSettingSPWebString = (_, __) =>
            {
                getListsAndFields = true;
                return(KeyVal4);
            };
            ShimMyWork.GetArchivedWebsGuid = _ => new List <Guid> {
                DummyGuid
            };
            ShimMyWork.GetSpContentDbSqlConnectionSPWeb = _ => new SqlConnection();
            ShimSqlConnection.AllInstances.Open         = _ => { };
            ShimSqlConnection.AllInstances.Close        = _ => { };

            ShimSqlCommand.ConstructorStringSqlConnection = (instance, commandText, connection) =>
            {
                sqlCommandCtorCommandText = commandText;
            };

            shimSqlDataReader.FieldCountGet  = () => fieldsCount;
            shimSqlDataReader.GetGuidInt32   = columnIndex => DummyGuid;
            shimSqlDataReader.GetStringInt32 = columnIndex => DummyString;
            shimSqlDataReader.Read           = () => readMethodSwitcher = !readMethodSwitcher;

            ShimSqlCommand.AllInstances.ExecuteReader = instance =>
            {
                executeReaderCalled = true;
                foreach (SqlParameter param in instance.Parameters)
                {
                    parameterList.Add(param);
                }
                return(shimSqlDataReader.Instance);
            };
            ShimExtensionMethods.ToPrettierNameStringStringSPWeb = (_, __, ___) => DummyString;
        }
        private void SetupShims(ICollection spArray = null)
        {
            ShimCoreFunctions.getConnectionStringGuid = (_) => { return("Data Source=epmdb;Initial Catalog=PEPM_Dev_eelsayed_Fake;Integrated Security=True"); };

            var webApplication = new SPWebApplication()
            {
                Id = Guid.Empty
            };
            var spFieldCollection = new ShimSPFieldCollection()
            {
                ItemGetGuid = _ => (spArray as SPField[])?[0]
            };
            var spList = new ShimSPList()
            {
                FieldsGet = () => spFieldCollection
            };
            var spListCollection = new ShimSPListCollection()
            {
                ItemGetString = _ => spList,
                ItemGetGuid   = _ => spList
            };
            var spWeb = new ShimSPWeb()
            {
                Close    = () => { },
                ListsGet = () => spListCollection,
                GetAvailableWebTemplatesUInt32 = _ => null,
                AllUsersGet = () => new ShimSPUserCollection()
            };
            var shimSPSite = new ShimSPSite()
            {
                IDGet                = () => new Guid(),
                WebApplicationGet    = () => webApplication,
                RootWebGet           = () => spWeb,
                UrlGet               = () => ValidUrl,
                Close                = () => { },
                ServerRelativeUrlGet = () => ValidUrl
            };

            ShimSPWeb.AllInstances.UrlGet   = _ => ValidUrl;
            ShimSPWeb.AllInstances.SiteGet  = _ => shimSPSite;
            ShimSPWeb.AllInstances.ListsGet = _ => spListCollection;
            ShimSPWeb.AllInstances.WebsGet  = _ => new ShimSPWebCollection()
            {
                AddStringStringStringUInt32StringBooleanBoolean = (a, b, c, d, e, f, g) => spWeb
            };
            ShimSPSite.ConstructorString = (site, _) =>
            {
                site = shimSPSite;
            };
            ShimSPSite.ConstructorGuid = (site, _) =>
            {
                site = shimSPSite;
            };
            ShimSPSite.AllInstances.RootWebGet        = _ => spWeb;
            ShimSPSite.AllInstances.WebApplicationGet = _ => webApplication;
            ShimSPSite.AllInstances.OpenWeb           = _ => new ShimSPWeb();
            ShimSPSite.AllInstances.Close             = _ => { };
            ShimSPContext.CurrentGet = () => new ShimSPContext()
            {
                SiteGet = () => shimSPSite,
                WebGet  = () => spWeb
            };
            if (spArray == null)
            {
                spArray = new SPField[0];
            }
            ShimSPBaseCollection.AllInstances.GetEnumerator            = _ => spArray.GetEnumerator();
            ShimCustomFields.AllInstances.ReadCustomFieldsByEntityGuid =
                (_, __) => new CustomFieldDataSet();
            ShimSqlConnection.AllInstances.Open = _ =>
            {
                _isConnectionOpenedCalled = true;
            };
            ShimSqlCommand.AllInstances.ExecuteReader = _ =>
            {
                _executeReaderCallCount++;
                return(new ShimSqlDataReader());
            };
            ShimSqlCommand.AllInstances.ExecuteNonQuery = _ =>
            {
                _isExecuteNonQueryCalled = true;
                return(0);
            };
            ShimSPSecurity.RunWithElevatedPrivilegesSPSecurityCodeToRunElevated = (_) =>
            {
                _.Invoke();
            };
            ShimEventLog.AllInstances.WriteEntryStringEventLogEntryTypeInt32 = (a, b, c, d) =>
            {
                _isWriteEntryCalled = true;
            };
            var projectDataTable = CreateProjectDataTable();

            ShimProject.AllInstances.ReadProjectGuidDataStoreEnum = (_, __, ___) => new ShimProjectDataSet()
            {
                ProjectGet = () => projectDataTable
            };
            ShimSqlConnection.AllInstances.DisposeBoolean = (_, __) =>
            {
                _isConnectionDisposeCalled = true;
            };
            ShimSqlCommand.AllInstances.DisposeBoolean = (_, __) =>
            {
                _sqlCommandDisposeCallCount++;
            };
            ShimEventLog.AllInstances.DisposeBoolean = (_, __) =>
            {
                _isEventLogDisposeCalled = true;
            };
            ShimWssInterop.AllInstances.ReadWssSettings = _ => new ShimWssSettingsDataSet()
            {
                WssAdminGet = () => new ShimWssAdminDataTable()
                {
                    ItemGetInt32 = (index) => new ShimWssAdminRow()
                    {
                        WADMIN_DEFAULT_SITE_COLLECTIONGet = () => string.Empty,
                        WADMIN_STS_TEMPLATE_LCIDGet       = () => 1
                    }
                }
            };
        }
        public void ListIdTest()
        {
            var testParams = "<Data>" +
                             "<Param key=\"SiteId\">7F316E11-C842-4440-9918-39A8F1C12DA9</Param>" +
                             "<Param key=\"WebId\">1A8F7946-CCA1-4A24-8785-CE8E32D012BE</Param>" +
                             "<Param key=\"ListId\">5D592B57-C072-4B36-8809-11262120484D</Param>" +
                             "</Data>";

            var analyticsData = new AnalyticsData(testParams, AnalyticsType.Favorite, AnalyticsAction.Read);

            using (new SPEmulators.SPEmulationContext(SPEmulators.IsolationLevel.Fake))
            {
                ShimSPSecurity.RunWithElevatedPrivilegesSPSecurityCodeToRunElevated = (w) =>
                {
                    w();
                };

                ShimSPSite.ConstructorGuid = (instance, guid) =>
                {
                    ShimSPSite moledInstance = new ShimSPSite(instance);
                    moledInstance.Dispose     = () => { };
                    moledInstance.OpenWebGuid = (guid1) =>
                    {
                        ShimSPWeb web = new ShimSPWeb();
                        web.Dispose  = () => { };
                        web.UsersGet = () =>
                        {
                            ShimSPUserCollection users = new ShimSPUserCollection();
                            users.CountGet = () => 0;
                            return(users);
                        };
                        web.ListsGet = () =>
                        {
                            ShimSPListCollection lists = new ShimSPListCollection();
                            lists.ItemGetGuid = (guid2) =>
                            {
                                ShimSPList list = new ShimSPList();
                                //list.TitleGet = () => { return listTitle; };
                                list.HiddenGet = () => { return(false); };
                                return(list);
                            };

                            return(lists);
                        };

                        return(web);
                    };
                };


                Assert.AreEqual(analyticsData.ListId, new Guid("5D592B57-C072-4B36-8809-11262120484D"));
                Assert.AreEqual(analyticsData.WebId, new Guid("1A8F7946-CCA1-4A24-8785-CE8E32D012BE"));
                Assert.AreEqual(analyticsData.SiteId, new Guid("7F316E11-C842-4440-9918-39A8F1C12DA9"));

                //Isolate.Fake.StaticConstructor(typeof(SPSecurity));
                //Isolate.WhenCalled(() => SPSecurity.RunWithElevatedPrivileges(() => { })).DoInstead((ctx) => Console.WriteLine("called"));
                //var fakeSite = Isolate.Fake.NextInstance<SPSite>();

                Assert.AreEqual(analyticsData.Icon, "icon-file-5");
            }
        }
示例#20
0
 private void SetupVariables()
 {
     validations       = 0;
     publicStatic      = BindingFlags.Static | BindingFlags.Public;
     nonPublicStatic   = BindingFlags.Static | BindingFlags.NonPublic;
     publicInstance    = BindingFlags.Instance | BindingFlags.Public;
     nonPublicInstance = BindingFlags.Instance | BindingFlags.NonPublic;
     guid    = Guid.Parse(SampleGuidString1);
     request = new Dictionary <string, string>()
     {
         ["period"]     = DummyString,
         ["action"]     = DummyString,
         ["duser"]      = DummyString,
         ["ts_uids"]    = DummyString,
         ["tsitemuids"] = DummyString
     };
     currentDate = DateTime.Now;
     spWeb       = new ShimSPWeb()
     {
         IDGet                = () => guid,
         SiteGet              = () => spSite,
         ListsGet             = () => spListCollection,
         GetFolderString      = _ => spFolder,
         GetFileString        = _ => spFile,
         FoldersGet           = () => spFolderCollection,
         CurrentUserGet       = () => spUser,
         ServerRelativeUrlGet = () => SampleUrl,
         AllUsersGet          = () => new ShimSPUserCollection(),
         SiteUsersGet         = () => new ShimSPUserCollection(),
         TitleGet             = () => DummyString
     };
     spSite = new ShimSPSite()
     {
         IDGet             = () => guid,
         WebApplicationGet = () => new ShimSPWebApplication(),
         RootWebGet        = () => spWeb,
         FeaturesGet       = () => new ShimSPFeatureCollection()
         {
             ItemGetGuid = _ => new ShimSPFeature()
         },
         ContentDatabaseGet = () => new ShimSPContentDatabase()
     };
     spListCollection = new ShimSPListCollection()
     {
         TryGetListString = _ => spList,
         ItemGetString    = _ => spList,
         ItemGetGuid      = _ => spList
     };
     spList = new ShimSPList()
     {
         IDGet             = () => guid,
         FieldsGet         = () => spFieldCollection,
         GetItemByIdInt32  = _ => spListItem,
         ItemsGet          = () => spListItemCollection,
         GetItemsSPQuery   = _ => spListItemCollection,
         RootFolderGet     = () => spFolder,
         ParentWebGet      = () => spWeb,
         DefaultViewGet    = () => spView,
         ViewsGet          = () => spViewCollection,
         ContentTypesGet   = () => spContentTypeCollection,
         TitleGet          = () => DummyString,
         EventReceiversGet = () => new ShimSPEventReceiverDefinitionCollection(),
         DefaultViewUrlGet = () => SampleUrl
     };
     spListItemCollection = new ShimSPListItemCollection()
     {
         CountGet     = () => DummyInt,
         ItemGetInt32 = _ => spListItem
     };
     spListItem = new ShimSPListItem()
     {
         IDGet             = () => DummyInt,
         TitleGet          = () => DummyString,
         ItemGetString     = _ => DummyString,
         ItemGetGuid       = _ => DummyString,
         ItemSetGuidObject = (_, __) => { },
         Update            = () => { },
         FileGet           = () => spFile,
         ParentListGet     = () => spList,
         NameGet           = () => DummyString
     };
     spFieldCollection = new ShimSPFieldCollection()
     {
         GetFieldByInternalNameString = _ => spField,
         ContainsFieldString          = _ => false,
         GetFieldString = _ => spField,
         ItemGetString  = _ => spField
     };
     spField = new ShimSPField()
     {
         IdGet            = () => guid,
         TitleGet         = () => DummyString,
         InternalNameGet  = () => DummyString,
         ReadOnlyFieldGet = () => false,
         HiddenGet        = () => false,
         ReorderableGet   = () => true,
         TypeAsStringGet  = () => DummyString
     };
     spUser = new ShimSPUser()
     {
         IDGet          = () => DummyInt,
         IsSiteAdminGet = () => true,
         UserTokenGet   = () => new ShimSPUserToken(),
         EmailGet       = () => DummyString
     };
     spFolderCollection = new ShimSPFolderCollection()
     {
         ItemGetString = _ => spFolder,
         AddString     = _ => spFolder
     };
     spFolder = new ShimSPFolder()
     {
         ExistsGet     = () => false,
         SubFoldersGet = () => spFolderCollection,
         FilesGet      = () => spFileCollection,
         UrlGet        = () => SampleUrl,
         UniqueIdGet   = () => guid,
         ParentWebGet  = () => spWeb
     };
     spFileCollection = new ShimSPFileCollection()
     {
         CountGet = () => DummyInt,
         AddStringByteArrayBoolean = (_1, _2, _3) => spFile,
         AddStringStream           = (_1, _2) => spFile,
         ItemGetString             = _ => spFile
     };
     spFile = new ShimSPFile()
     {
         Delete                 = () => { },
         OpenBinaryStream       = () => null,
         NameGet                = () => DummyString,
         GetListItemStringArray = _ => spListItem
     };
     spViewCollection = new ShimSPViewCollection()
     {
         ItemGetString = _ => spView
     };
     spView = new ShimSPView()
     {
         ViewFieldsGet        = () => spViewFieldCollection,
         ServerRelativeUrlGet = () => SampleUrl
     };
     spViewFieldCollection   = new ShimSPViewFieldCollection();
     spContentTypeCollection = new ShimSPContentTypeCollection()
     {
         ItemGetString = _ => spContentType
     };
     spContentType = new ShimSPContentType()
     {
         IdGet         = () => default(SPContentTypeId),
         FieldLinksGet = () => spFieldLinkCollection
     };
     spFieldLinkCollection = new ShimSPFieldLinkCollection()
     {
         ItemGetGuid = _ => new ShimSPFieldLink()
     };
     transaction = new ShimSqlTransaction()
     {
         Commit   = () => { },
         Rollback = () => { }
     };
     dataReader = new ShimSqlDataReader()
     {
         Read             = () => false,
         GetInt32Int32    = _ => One,
         GetDateTimeInt32 = _ => currentDate,
         GetStringInt32   = _ => DummyString,
         GetGuidInt32     = _ => guid,
         Close            = () => { }
     };
 }
        private static void PrepareShims(string listTitle, bool generateQueryExecutorError = false)
        {
            System.Web.Fakes.ShimHttpContext.AllInstances.ItemsGet =
                (e) =>
            {
                return(new Dictionary <string, object>());
            };

            System.Web.Fakes.ShimHttpContext.CurrentGet = () =>
            {
                return(new System.Web.Fakes.ShimHttpContext());
            };

            System.Web.Fakes.ShimHttpContext.AllInstances.DisableCustomHttpEncoderGet = (instance) =>
            {
                return(true);
            };

            string expectedTitle = "Test Site";

            ShimSPSite.BehaveAsNotImplemented();
            ShimSPWeb.BehaveAsNotImplemented();
            ShimSPSite.ConstructorString = (instance, url) =>
            {
                ShimSPSite moledInstance = new ShimSPSite(instance);
                moledInstance.Dispose = () => { };
                moledInstance.OpenWeb = () =>
                {
                    ShimSPWeb web = new ShimSPWeb();
                    web.Dispose  = () => { };
                    web.UsersGet = () =>
                    {
                        ShimSPUserCollection users = new ShimSPUserCollection();
                        users.CountGet = () => 0;
                        return(users);
                    };
                    return(web);
                };
            };

            ShimSPSite.ConstructorGuid = (instance, guid) =>
            {
                ShimSPSite moledInstance = new ShimSPSite(instance);
                moledInstance.Dispose     = () => { };
                moledInstance.OpenWebGuid = (guid1) =>
                {
                    ShimSPWeb web = new ShimSPWeb();
                    web.Dispose  = () => { };
                    web.UsersGet = () =>
                    {
                        ShimSPUserCollection users = new ShimSPUserCollection();
                        users.CountGet = () => 0;
                        return(users);
                    };
                    web.ListsGet = () =>
                    {
                        ShimSPListCollection lists = new ShimSPListCollection();
                        lists.ItemGetGuid = (guid2) =>
                        {
                            ShimSPList list = new ShimSPList();
                            list.TitleGet  = () => { return(listTitle); };
                            list.HiddenGet = () => { return(false); };
                            return(list);
                        };

                        return(lists);
                    };

                    return(web);
                };
            };

            ShimSPSite.AllInstances.Dispose = (instance) => { };
            ShimSPSite.AllInstances.OpenWeb = (instance) =>
            {
                ShimSPWeb web = new ShimSPWeb();
                web.Dispose  = () => { };
                web.TitleGet = () => expectedTitle;
                return(web);
            };

            ShimQueryExecutor.ConstructorSPWeb = (instance, spweb) =>
            {
                ShimQueryExecutor moledInstance = new ShimQueryExecutor(instance);
                //moledInstance.Dispose = () => { };
                moledInstance.ExecuteEpmLiveQueryStringIDictionaryOfStringObject =
                    (str1, dict) =>
                {
                    if (generateQueryExecutorError)
                    {
                        throw new NotImplementedException("message");
                    }

                    DataTable  dt        = new DataTable();
                    DataRow    newRow    = dt.NewRow();
                    DataColumn newColumn = new DataColumn("CustomerID");
                    dt.Columns.Add(newColumn);
                    newRow["CustomerID"] = "ALFKI";

                    dt.Rows.Add(newRow);
                    return(dt);
                };
            };
        }
        private ShimSPWeb ArrangeForExecute()
        {
            var list = new List <SPUser>
            {
                new ShimSPUser
                {
                    IDGet    = () => 11,
                    NameGet  = () => "Name",
                    EmailGet = () => "Email"
                }
            };
            var shimSPUserCollection = new ShimSPUserCollection
            {
                GetByIDInt32 = intValue => list[0]
            };

            new ShimSPBaseCollection(shimSPUserCollection)
            {
                GetEnumerator = () => list.GetEnumerator()
            };
            return(new ShimSPWeb
            {
                AllUsersGet = () => shimSPUserCollection,
                ListsGet = () =>
                {
                    var listSpList = new List <SPList>
                    {
                        new ShimSPList
                        {
                            GetItemsSPQuery = spQuery =>
                            {
                                var listSPField = new List <SPField>
                                {
                                    new ShimSPField
                                    {
                                        InternalNameGet = () => "InternalName",
                                        SchemaXmlGet = () => " Percentage=\"TRUE\""
                                    }
                                };
                                var listListItem = new List <SPListItem>
                                {
                                    new ShimSPListItem
                                    {
                                        FieldsGet = () =>
                                        {
                                            var shimSPFieldCollection = new ShimSPFieldCollection
                                            {
                                                GetFieldByInternalNameString = stringValue => listSPField[0]
                                            };
                                            new ShimSPBaseCollection(shimSPUserCollection)
                                            {
                                                GetEnumerator = () => listSPField.GetEnumerator()
                                            };
                                            return shimSPFieldCollection;
                                        },
                                        ItemGetGuid = guidValue => "2018-05-12"
                                    }
                                };
                                var shimSPListItemCollection = new ShimSPListItemCollection
                                {
                                    CountGet = () => listListItem.Count,
                                    GetEnumerator = () => listListItem.GetEnumerator()
                                };
                                return shimSPListItemCollection;
                            }
                        }
                    };
                    var shim = new ShimSPListCollection
                    {
                        ItemGetString = stringValue => listSpList[0]
                    };
                    new ShimSPBaseCollection(shim)
                    {
                        GetEnumerator = () => listSpList.GetEnumerator()
                    };
                    return shim;
                },
                LocaleGet = () => new CultureInfo("en-US"),
                PropertiesGet = () =>
                {
                    var shim = new ShimSPPropertyBag();
                    var stringDictionary = new StringDictionary
                    {
                        ["EPMLiveNotificationLists"] = "notification|notificationC`notification|notificationC`notification|notificationC`notification|notificationC",
                        ["EPMLiveNotificationEmail"] = "EPMLiveNotificationEmail",
                        ["EPMLiveNotificationEmailSubject"] = "EPMLiveNotificationEmailSubject",
                        ["EPMLiveNotificationNote"] = "EPMLiveNotificationNote",
                        ["EPMLiveLogDetailedErrors"] = "EPMLiveLogDetailedErrors",
                        ["EPMLiveNotificationOptedOutUsers"] = "10"
                    };
                    new ShimStringDictionary(shim)
                    {
                        ContainsKeyString = key => stringDictionary.ContainsKey(key),
                        ItemGetString = key => stringDictionary.ContainsKey(key)
                            ? stringDictionary[key]
                            : null,
                        ItemSetStringString = (key, stringValue) =>
                        {
                            if (stringDictionary.ContainsKey(key))
                            {
                                stringDictionary[key] = stringValue;
                            }
                            else
                            {
                                stringDictionary.Add(key, stringValue);
                            }
                        }
                    };
                    return shim;
                },
                SiteUsersGet = () => shimSPUserCollection,
                UrlGet = () => SpWebUrl,
                WebsGet = () =>
                {
                    var shim = new ShimSPWebCollection();
                    new ShimSPBaseCollection(shim)
                    {
                        GetEnumerator = () => new List <SPWeb>().GetEnumerator()
                    };
                    return shim;
                }
            });
        }
        private void SetupShim()
        {
            const int fieldsCount               = 1;
            var       shimSqlDataReader         = new ShimSqlDataReader();
            var       parameterList             = new List <SqlParameter>();
            var       sqlCommandCtorCommandText = string.Empty;

            readMethodSwitcher = true;
            getListsAndFields  = false;
            settingSaved       = false;
            _spLists           = new[] {
                new ShimSPList {
                    IDGet = () => Guid.NewGuid()
                }
            };
            _spListCollectionShim = new ShimSPListCollection()
            {
                TryGetListString = _ => new ShimSPList {
                },
                ItemGetString    = name => new ShimSPList
                {
                    ItemsGet = () =>
                    {
                        var spListItemCollection = new List <SPListItem>
                        {
                            new ShimSPListItem
                            {
                                ItemGetGuid = guid => DummyString + ".MASTER",
                                FieldsGet   = () => new ShimSPFieldCollection
                                {
                                    GetFieldByInternalNameString = internalName => new ShimSPField
                                    {
                                        IdGet = () => DummyGuid
                                    }
                                }
                            }
                        };
                        return(new ShimSPListItemCollection().Bind(spListItemCollection));
                    },
                    FieldsGet = () =>
                    {
                        var list = new List <SPField>
                        {
                            new ShimSPField()
                            {
                                HiddenGet       = () => false,
                                InternalNameGet = () => DummyString
                            }
                        };
                        return(new ShimSPFieldCollection().Bind(list));
                    }
                }
            };
            _spListCollectionShim.Bind(_spLists.Select(shim => shim.Instance));
            SPWeb spWeb = new ShimSPWeb
            {
                IDGet = () => DummyGuid,
                ServerRelativeUrlGet = () => DummyUrl,
                ListsGet             = () => _spListCollectionShim,
                SiteGet = () => new ShimSPSite
                {
                    IDGet             = () => DummyGuid,
                    WebApplicationGet = () => new ShimSPWebApplication
                    {
                    }.Instance
                },
                CurrentUserGet = () => new ShimSPUser
                {
                    IsSiteAdminGet = () => false
                },
                PropertiesGet = () => new ShimSPPropertyBag {
                }.Instance
            };

            ShimSPWeb.AllInstances.PropertiesGet = (a) => new ShimSPPropertyBag {
                Update = () => new object { }
            };
            ShimStringDictionary.AllInstances.ContainsKeyString = (a, b) => true;
            ShimSPContext.CurrentGet = () => new ShimSPContext
            {
                WebGet = () => spWeb
            };
            ShimCoreFunctions.setConfigSettingSPWebStringString = (_, __, ___) => settingSaved = true;
            ShimCoreFunctions.getConfigSettingSPWebString       = (_, __) =>
            {
                getListsAndFields = true;
                return("true");
            };
            ShimMyWork.GetArchivedWebsGuid = _ => new List <Guid> {
                DummyGuid
            };

            ShimCoreFunctions.getConnectionStringGuid = guid => DummyString;
            ShimSqlConnection.ConstructorString       = (_, connectionString) => { };

            ShimMyWork.GetSpContentDbSqlConnectionSPWeb = _ => new SqlConnection();
            ShimSqlConnection.AllInstances.Open         = _ => { };
            ShimSqlConnection.AllInstances.Close        = _ => { };

            ShimSqlCommand.ConstructorStringSqlConnection = (instance, commandText, connection) =>
            {
                sqlCommandCtorCommandText = commandText;
            };

            shimSqlDataReader.FieldCountGet  = () => fieldsCount;
            shimSqlDataReader.GetGuidInt32   = columnIndex => DummyGuid;
            shimSqlDataReader.GetStringInt32 = columnIndex => DummyString;
            shimSqlDataReader.Read           = () => readMethodSwitcher = !readMethodSwitcher;

            ShimSqlCommand.AllInstances.ExecuteReader = instance =>
            {
                executeReaderCalled = true;
                foreach (SqlParameter param in instance.Parameters)
                {
                    parameterList.Add(param);
                }
                return(shimSqlDataReader.Instance);
            };
            ShimExtensionMethods.ToPrettierNameStringStringSPWeb = (_, __, ___) => DummyString;
            ShimPage.AllInstances.IsPostBackGet = _ => false;
        }
示例#24
0
        public void BuildData_Should_ReturnsStringEmptyFillProperties()
        {
            // Arrange
            _siteList = new ShimSPListCollection()
            {
                ItemGetString = itemName =>
                {
                    switch (itemName)
                    {
                    case "Project Center":
                        return(new ShimSPList()
                        {
                            ItemsGet = () => new ShimSPListItemCollection().Bind(
                                new SPListItem[]
                            {
                                new ShimSPListItem()
                                {
                                    ItemGetString = itemNameListItem => "(2) Active"
                                }
                            })
                        });

                    case "Task Center":
                        return(new ShimSPList());

                    case "Issues":
                        return(new ShimSPList());

                    case "Risks":
                        return(new ShimSPList());

                    default:
                        break;
                    }

                    return(null);
                }
            };

            // Act
            var actualResult = _testEntity.buildData(true, true, true);

            // Assert
            var gridViewSummary = _testEntity.gvPJSummary;

            this.ShouldSatisfyAllConditions(
                () => actualResult.ShouldBe(string.Empty),
                () => gridViewSummary.AllowGrouping.ShouldBeFalse(),
                () => gridViewSummary.ID.ShouldBe("gvPJSummary"),
                () => gridViewSummary.Width.ShouldBe(Unit.Percentage(100)),
                () => gridViewSummary.HeaderStyle.CssClass.ShouldBe("ms-vh"),
                () => gridViewSummary.Columns.Count.ShouldBe(6),
                () => gridViewSummary.Columns[0].HeaderText.ShouldBe("Project Name"),
                () => gridViewSummary.Columns[1].HeaderText.ShouldBe("% Complete"),
                () => gridViewSummary.Columns[2].HeaderText.ShouldBe("# of Late Tasks"),
                () => gridViewSummary.Columns[3].HeaderText.ShouldBe("Schedule Status"),
                () => gridViewSummary.Columns[4].HeaderText.ShouldBe("Issue Status"),
                () => gridViewSummary.Columns[5].HeaderText.ShouldBe("Risk Status"),
                () => gridViewSummary.Rows.Count.ShouldBe(1),
                () => gridViewSummary.Rows[0].Cells.Count.ShouldBe(6),
                () => gridViewSummary.Rows[0].Cells[0].Text.ShouldBe("<a href=\"/Lists/Project%20Center/DispForm.aspx?ID=0\"></a>"),
                () => gridViewSummary.Rows[0].Cells[1].Text.ShouldBe("0%"),
                () => gridViewSummary.Rows[0].Cells[2].Text.ShouldBe("-1"),
                () => gridViewSummary.Rows[0].Cells[3].Text.ShouldBe("<img src=\"/_layouts/images/green.gif\">"),
                () => gridViewSummary.Rows[0].Cells[4].Text.ShouldBe("<img src=\"/_layouts/images/.gif\">"),
                () => gridViewSummary.Rows[0].Cells[5].Text.ShouldBe("<img src=\"/_layouts/images/.gif\">"));
        }