public void GetData_ReturnsDataTable()
        {
            // Arrange
            ShimSPWeb.AllInstances.IDGet = (_) => { return(new Guid()); };

            // Act
            _testObj.GetData(new Dictionary <string, IEnumerable <object> >(), ReportingScope.Web, new ShimSPWeb());

            // Assert
            Assert.IsTrue(_adoShims.IsCommandCreated(GetDataSql));
            Assert.IsTrue(_adoShims.IsCommandExecuted(GetDataSql));
            Assert.IsTrue(_adoShims.IsDataReaderCreatedForCommand(GetDataSql));
            Assert.IsTrue(_adoShims.IsDataReaderDisposedForCommand(GetDataSql));
        }
Пример #2
0
        /// <summary>
        ///     Gets my work data for resources.
        /// </summary>
        /// <param name="resources">The resources.</param>
        /// <param name="reportingScope">The reporting scope.</param>
        /// <param name="startDate">The start date.</param>
        /// <param name="dueDate">The due date.</param>
        /// <returns></returns>
        private DataTable GetMyWorkDataForResources(IEnumerable <SPFieldUserValue> resources,
                                                    ReportingScope reportingScope,
                                                    DateTime startDate, DateTime dueDate)
        {
            DataTable dataTable;

            using (var myWorkReportData = new MyWorkReportData(Web.Site.ID))
            {
                dataTable =
                    myWorkReportData.GetData(new Dictionary <string, IEnumerable <object> >
                {
                    { "AssignedToId", from r in resources select(object) r.LookupId },
                    { "StartDate", new[] { (object)startDate } },
                    { "DueDate", new[] { (object)dueDate } },
                }, reportingScope, Web);
            }

            return(dataTable);
        }