// Implementation for step Execute Actual Query for Sum of Cost good sold for PM FYTD private void SumofCostgoodsoldforPMFYTD_ExecuteActualQuery() { Dictionary <string, object> beforeTestElementResourceSnapshot = _testResources.Snapshot(); bool cancel = false; BeforeTestElement("Sum of Cost good sold for PM FYTD", "Execute Actual Query", beforeTestElementResourceSnapshot, ref cancel); if (cancel) { return; } _testResources.Merge(beforeTestElementResourceSnapshot); try { try { // Read asset SSAS Matrix Production Connection connection = Connection.ReadFromByteArray(Resources.TestResource_SSASMatrixProduction_b89de6cae6604205b75e0566246db3fc); connection.ConnectionString = parameterProvider.GetTypedParameter <string>(new Guid("b89de6ca-e660-4205-b75e-0566246db3fc"), "ConnectionString", connection.ConnectionString); connection.ProviderInvariantName = parameterProvider.GetTypedParameter <string>(new Guid("b89de6ca-e660-4205-b75e-0566246db3fc"), "ProviderInvariantName", connection.ProviderInvariantName); // Read asset Actual Query string query = parameterProvider.GetTypedParameter <string>(new Guid("c672e003-103f-4291-84b7-77e5b3cdffa4"), "Value", Resources.TestResource_ActualQuery_c672e003103f429184b777e5b3cdffa4); GridCollection gridCollection = GridCollectionLoader.LoadGrid(connection.ProviderInvariantName, connection.ConnectionString, query, false, parameterProvider.GetTypedParameter <int>(new Guid("7269c7f9-6895-4b93-acac-0ba41891004a"), "Timeout", 30)); try { Assert.Greater(gridCollection.Count, 0, "Expected a result set collection with at least 1 result sets."); testStateTracker.PushAssertResult(new Guid("7269c7f9-6895-4b93-acac-0ba41891004a"), "Execute Actual Query : Grid Count", 0, gridCollection.Count, true); } catch { testStateTracker.PushAssertResult(new Guid("7269c7f9-6895-4b93-acac-0ba41891004a"), "Execute Actual Query : Grid Count", 0, gridCollection.Count, false); throw; } _testResources["SqlTest_RightQuery"] = gridCollection[0]; } catch (Exception exception) { throw new TestExecutionStepException("Cost of goods Sold", "Sum of Cost good sold for PM FYTD", "Execute Actual Query", 2, exception); } } finally { Dictionary <string, object> afterTestElementResourceSnapshot = _testResources.Snapshot(); AfterTestElement("Sum of Cost good sold for PM FYTD", "Execute Actual Query", afterTestElementResourceSnapshot); _testResources.Merge(afterTestElementResourceSnapshot); } }
// Implementation for step Execute Actual Query for Sum of Cost good sold FYTD private void SumofCostgoodsoldFYTD_ExecuteActualQuery() { Dictionary <string, object> beforeTestElementResourceSnapshot = _testResources.Snapshot(); bool cancel = false; BeforeTestElement("Sum of Cost good sold FYTD", "Execute Actual Query", beforeTestElementResourceSnapshot, ref cancel); if (cancel) { return; } _testResources.Merge(beforeTestElementResourceSnapshot); try { try { // Read asset SSAS Matrix Production Connection connection = Connection.ReadFromByteArray(Resources.TestResource_SSASMatrixProduction_b89de6cae6604205b75e0566246db3fc); connection.ConnectionString = parameterProvider.GetTypedParameter <string>(new Guid("b89de6ca-e660-4205-b75e-0566246db3fc"), "ConnectionString", connection.ConnectionString); connection.ProviderInvariantName = parameterProvider.GetTypedParameter <string>(new Guid("b89de6ca-e660-4205-b75e-0566246db3fc"), "ProviderInvariantName", connection.ProviderInvariantName); // Read asset Actual Query string query = parameterProvider.GetTypedParameter <string>(new Guid("30ba6fe4-ea85-4003-adc6-5b4ae5e9619d"), "Value", Resources.TestResource_ActualQuery_30ba6fe4ea854003adc65b4ae5e9619d); GridCollection gridCollection = GridCollectionLoader.LoadGrid(connection.ProviderInvariantName, connection.ConnectionString, query, false, parameterProvider.GetTypedParameter <int>(new Guid("d3c22b2a-f3da-4023-a32c-5c858f9fc1a5"), "Timeout", 30)); try { Assert.Greater(gridCollection.Count, 0, "Expected a result set collection with at least 1 result sets."); testStateTracker.PushAssertResult(new Guid("d3c22b2a-f3da-4023-a32c-5c858f9fc1a5"), "Execute Actual Query : Grid Count", 0, gridCollection.Count, true); } catch { testStateTracker.PushAssertResult(new Guid("d3c22b2a-f3da-4023-a32c-5c858f9fc1a5"), "Execute Actual Query : Grid Count", 0, gridCollection.Count, false); throw; } _testResources["SqlTest_RightQuery"] = gridCollection[0]; } catch (Exception exception) { throw new TestExecutionStepException("Cost of goods Sold", "Sum of Cost good sold FYTD", "Execute Actual Query", 2, exception); } } finally { Dictionary <string, object> afterTestElementResourceSnapshot = _testResources.Snapshot(); AfterTestElement("Sum of Cost good sold FYTD", "Execute Actual Query", afterTestElementResourceSnapshot); _testResources.Merge(afterTestElementResourceSnapshot); } }
// Implementation for step Execute Expected Query for Sum of Cost good sold for PM FYTD private void SumofCostgoodsoldforPMFYTD_ExecuteExpectedQuery() { Dictionary <string, object> beforeTestElementResourceSnapshot = _testResources.Snapshot(); bool cancel = false; BeforeTestElement("Sum of Cost good sold for PM FYTD", "Execute Expected Query", beforeTestElementResourceSnapshot, ref cancel); if (cancel) { return; } _testResources.Merge(beforeTestElementResourceSnapshot); try { try { // Read asset DWH stage Connection connection = Connection.ReadFromByteArray(Resources.TestResource_DWHstage_9c0a93a6e32045e78e7d50bba97c5f8f); connection.ConnectionString = parameterProvider.GetTypedParameter <string>(new Guid("9c0a93a6-e320-45e7-8e7d-50bba97c5f8f"), "ConnectionString", connection.ConnectionString); connection.ProviderInvariantName = parameterProvider.GetTypedParameter <string>(new Guid("9c0a93a6-e320-45e7-8e7d-50bba97c5f8f"), "ProviderInvariantName", connection.ProviderInvariantName); // Read asset Expected Query string query = parameterProvider.GetTypedParameter <string>(new Guid("8629fb71-ec16-453f-9278-9ff33904fd31"), "Value", Resources.TestResource_ExpectedQuery_8629fb71ec16453f92789ff33904fd31); GridCollection gridCollection = GridCollectionLoader.LoadGrid(connection.ProviderInvariantName, connection.ConnectionString, query, false, parameterProvider.GetTypedParameter <int>(new Guid("f184b763-539e-4f5d-984f-f4625f0a6b2e"), "Timeout", 30)); try { Assert.Greater(gridCollection.Count, 0, "Expected a result set collection with at least 1 result sets."); testStateTracker.PushAssertResult(new Guid("f184b763-539e-4f5d-984f-f4625f0a6b2e"), "Execute Expected Query : Grid Count", 0, gridCollection.Count, true); } catch { testStateTracker.PushAssertResult(new Guid("f184b763-539e-4f5d-984f-f4625f0a6b2e"), "Execute Expected Query : Grid Count", 0, gridCollection.Count, false); throw; } _testResources["SqlTest_LeftQuery"] = gridCollection[0]; } catch (Exception exception) { throw new TestExecutionStepException("Cost of goods Sold", "Sum of Cost good sold for PM FYTD", "Execute Expected Query", 1, exception); } } finally { Dictionary <string, object> afterTestElementResourceSnapshot = _testResources.Snapshot(); AfterTestElement("Sum of Cost good sold for PM FYTD", "Execute Expected Query", afterTestElementResourceSnapshot); _testResources.Merge(afterTestElementResourceSnapshot); } }
// Implementation for step Execute Expected Query for Sum of Cost good sold FYTD private void SumofCostgoodsoldFYTD_ExecuteExpectedQuery() { Dictionary <string, object> beforeTestElementResourceSnapshot = _testResources.Snapshot(); bool cancel = false; BeforeTestElement("Sum of Cost good sold FYTD", "Execute Expected Query", beforeTestElementResourceSnapshot, ref cancel); if (cancel) { return; } _testResources.Merge(beforeTestElementResourceSnapshot); try { try { // Read asset DWH stage Connection connection = Connection.ReadFromByteArray(Resources.TestResource_DWHstage_9c0a93a6e32045e78e7d50bba97c5f8f); connection.ConnectionString = parameterProvider.GetTypedParameter <string>(new Guid("9c0a93a6-e320-45e7-8e7d-50bba97c5f8f"), "ConnectionString", connection.ConnectionString); connection.ProviderInvariantName = parameterProvider.GetTypedParameter <string>(new Guid("9c0a93a6-e320-45e7-8e7d-50bba97c5f8f"), "ProviderInvariantName", connection.ProviderInvariantName); // Read asset Expected Query string query = parameterProvider.GetTypedParameter <string>(new Guid("27860fdf-e98a-4c90-8980-0d9e987d1a72"), "Value", Resources.TestResource_ExpectedQuery_27860fdfe98a4c9089800d9e987d1a72); GridCollection gridCollection = GridCollectionLoader.LoadGrid(connection.ProviderInvariantName, connection.ConnectionString, query, false, parameterProvider.GetTypedParameter <int>(new Guid("1a7140f7-bae1-417c-b3ae-b3c6cb1036a5"), "Timeout", 30)); try { Assert.Greater(gridCollection.Count, 0, "Expected a result set collection with at least 1 result sets."); testStateTracker.PushAssertResult(new Guid("1a7140f7-bae1-417c-b3ae-b3c6cb1036a5"), "Execute Expected Query : Grid Count", 0, gridCollection.Count, true); } catch { testStateTracker.PushAssertResult(new Guid("1a7140f7-bae1-417c-b3ae-b3c6cb1036a5"), "Execute Expected Query : Grid Count", 0, gridCollection.Count, false); throw; } _testResources["SqlTest_LeftQuery"] = gridCollection[0]; } catch (Exception exception) { throw new TestExecutionStepException("Cost of goods Sold", "Sum of Cost good sold FYTD", "Execute Expected Query", 1, exception); } } finally { Dictionary <string, object> afterTestElementResourceSnapshot = _testResources.Snapshot(); AfterTestElement("Sum of Cost good sold FYTD", "Execute Expected Query", afterTestElementResourceSnapshot); _testResources.Merge(afterTestElementResourceSnapshot); } }