示例#1
0
        public ReportRequestPropertiesContainer BrowseTreeReport(DateTime?startDate   = null,
                                                                 DateTime?endDate     = null,
                                                                 string marketplaceId = null,
                                                                 bool?rootNodesOnly   = null,
                                                                 string browseNodeId  = null)
        {
            var reportOptions = new ReportOptions();

            if (!string.IsNullOrWhiteSpace(marketplaceId))
            {
                reportOptions.AddStringOption("MarketplaceId", marketplaceId);
            }
            if (rootNodesOnly.HasValue)
            {
                reportOptions.AddBooleanOption("RootNodesOnly", rootNodesOnly.Value);
            }
            if (!string.IsNullOrWhiteSpace(browseNodeId))
            {
                reportOptions.AddStringOption("BrowseNodeId", browseNodeId);
            }
            if (!reportOptions.Options.Any())
            {
                reportOptions = null;
            }

            var reportContainer = ReportGeneratorHelper.GenerateReportRequest("_GET_XML_BROWSE_TREE_DATA_", ContentUpdateFrequency.Unknown,
                                                                              requestedMarketplaces: (List <string>)null, startDate: startDate, endDate: endDate, reportOptions: reportOptions);

            return(reportContainer);
        }
示例#2
0
        public void AddStringOption_AddsTuplesToOptionsProperty_WithCorrectValues()
        {
            var initialNumberOfOptions = _reportOptions.Options.Count;

            _reportOptions.AddStringOption("testOptionName", "testOptionValue");
            _reportOptions.AddStringOption("testOptionName2", "testOptionValue2");

            Assert.AreEqual(0, initialNumberOfOptions);
            Assert.AreEqual(2, _reportOptions.Options.Count);
            Assert.AreEqual("testOptionName", _reportOptions.Options.First().Name);
            Assert.AreEqual("testOptionValue", _reportOptions.Options.First().Value);
            Assert.IsNotNull(_reportOptions.Options.FirstOrDefault(t => t.Name == "testOptionName2"));
        }