// // You can use the following additional attributes as you write your tests: // // Use ClassInitialize to run code before running the first test in the class // [ClassInitialize()] // public static void MyClassInitialize(TestContext testContext) { } // // Use ClassCleanup to run code after all tests in a class have run // [ClassCleanup()] // public static void MyClassCleanup() { } // // Use TestInitialize to run code before running each test // [TestInitialize()] // public void MyTestInitialize() { } // // Use TestCleanup to run code after each test has run // [TestCleanup()] // public void MyTestCleanup() { } // #endregion public void getProductSummary(ErrorIndexType indexType, int numProducts, int numFiles, int numEvents, int numEventInfos, int numCabs, int productId) { // Add a context. CreateNewStackHashContextResponse resp = m_Utils.CreateNewContext(indexType); String testPath = "c:\\stackhashunittests\\testindex\\"; resp.Settings.ErrorIndexSettings.Folder = testPath; resp.Settings.ErrorIndexSettings.Name = "TestIndex"; m_Utils.SetContextSettings(resp.Settings); m_Utils.DeleteIndex(0); // Make sure it is empty. m_Utils.ActivateContext(0); // Create a test index with one cab file. StackHashTestIndexData testIndexData = new StackHashTestIndexData(); testIndexData.NumberOfProducts = numProducts; testIndexData.NumberOfFiles = numFiles; testIndexData.NumberOfEvents = numEvents; testIndexData.NumberOfEventInfos = numEventInfos; testIndexData.NumberOfCabs = numCabs; m_Utils.CreateTestIndex(0, testIndexData); GetProductRollupResponse resp2 = m_Utils.GetProductSummary(0, productId); Assert.AreEqual(numFiles * numEvents * numEventInfos, resp2.RollupData.HitDateSummary.Count); Assert.AreEqual(numFiles * numEvents * numEventInfos, resp2.RollupData.LocaleSummaryCollection.Count); Assert.AreEqual(numFiles * numEvents * numEventInfos, resp2.RollupData.OperatingSystemSummary.Count); m_Utils.DeactivateContext(0); m_Utils.DeleteIndex(0); }
/// <summary> /// Gets product summary rollup data. /// </summary> /// <param name="requestData"></param> /// <returns></returns> public GetProductRollupResponse GetProductSummary(GetProductRollupRequest requestData) { if (requestData == null) { throw new ArgumentNullException("requestData"); } GetProductRollupResponse resp = new GetProductRollupResponse(); resp.RollupData = StaticObjects.TheStaticObjects.TheController.GetProductSummary(requestData.ContextId, requestData.ProductId); resp.ResultData = new StackHashServiceResultData( StackHashServiceResult.Success, s_OperationSuccessful, null); return(resp); }