Ejemplo n.º 1
0
        private void InitRefreshLists()
        {
            var spWeb = new ShimSPWeb()
            {
                SiteGet = () => new ShimSPSite()
                {
                    IDGet = () => DummySiteGuid
                }
            };

            ShimReportData.ConstructorGuid = (sender, guid) =>
            {
                var reportData = new ShimReportData(sender)
                {
                    GetListMappings = () =>
                    {
                        var dataTable = new DataTable();
                        dataTable.Columns.Add(ListNameField);

                        var row = dataTable.NewRow();
                        row[ListNameField] = DummyItemName;
                        dataTable.Rows.Add(row);

                        return(dataTable);
                    }
                };
            };
            _testObject    = new RefreshLists(spWeb, string.Empty);
            _privateObject = new PrivateObject(_testObject);
        }
Ejemplo n.º 2
0
        public void Constructor_ListWith1Item_FillPropertiesFromList()
        {
            // Arrange
            var spWeb = new ShimSPWeb()
            {
                SiteGet = () => new ShimSPSite()
                {
                    IDGet = () => DummySiteGuid
                }
            };

            ShimReportData.ConstructorGuid = (sender, guid) =>
            {
                var reportData = new ShimReportData(sender);
            };

            // Act
            _testObject = new RefreshLists(spWeb, DummyItemName);

            // Assert
            _privateObject = new PrivateObject(_testObject);
            var arrayListNames          = (string[])_privateObject.GetField(ArrayListNamesField);
            var arrayListTableNames     = (ArrayList)_privateObject.GetField(ArrayListTableNamesField);
            var dsLists                 = (DataSet)_privateObject.GetField(DsListsField);
            var dsMyWorkLists           = (DataSet)_privateObject.GetField(DsMyWorkListsField);
            var arrayListDefaultColumns = (ArrayList)_privateObject.GetField(ArrayListDefaultColumnsField);

            this.ShouldSatisfyAllConditions(
                () => arrayListNames[0].ShouldBe(DummyItemName),
                () => arrayListTableNames.ShouldNotBeNull(),
                () => dsLists.ShouldNotBeNull(),
                () => dsMyWorkLists.ShouldNotBeNull(),
                () => arrayListDefaultColumns.Count.ShouldBe(5));
        }
Ejemplo n.º 3
0
        public void Constructor_EmptyList_FillPropertiesFromDb()
        {
            // Arrange
            var spWeb = new ShimSPWeb()
            {
                SiteGet = () => new ShimSPSite()
                {
                    IDGet = () => DummySiteGuid
                }
            };

            ShimReportData.ConstructorGuid = (sender, guid) =>
            {
                var reportData = new ShimReportData(sender)
                {
                    GetListMappings = () =>
                    {
                        var dataTable = new DataTable();
                        dataTable.Columns.Add(ListNameField);

                        var row = dataTable.NewRow();
                        row[ListNameField] = DummyItemName;
                        dataTable.Rows.Add(row);

                        return(dataTable);
                    }
                };
            };

            // Act
            _testObject = new RefreshLists(spWeb, string.Empty);

            // Assert
            _privateObject = new PrivateObject(_testObject);
            var arrayListNames          = (string[])_privateObject.GetField(ArrayListNamesField);
            var arrayListTableNames     = (ArrayList)_privateObject.GetField(ArrayListTableNamesField);
            var dsLists                 = (DataSet)_privateObject.GetField(DsListsField);
            var dsMyWorkLists           = (DataSet)_privateObject.GetField(DsMyWorkListsField);
            var arrayListDefaultColumns = (ArrayList)_privateObject.GetField(ArrayListDefaultColumnsField);

            this.ShouldSatisfyAllConditions(
                () => arrayListNames[0].ShouldBe(DummyItemName),
                () => arrayListTableNames.ShouldNotBeNull(),
                () => dsLists.ShouldNotBeNull(),
                () => dsMyWorkLists.ShouldNotBeNull(),
                () => arrayListDefaultColumns.Count.ShouldBe(5));
        }