private CustomBillingData GetDisplayedCustomBillingData(string costSources) { var displayedCustomBillingData = new CustomBillingData(); var displayedBillingItems = new List <CustomBillingItem>(); //TODO - Handle scenario for two cost sources switch (costSources) { case SINGLE_COST_SOURCE: displayedBillingItems = GetDisplayedDataWithSingleCostSource(); break; case THREE_COST_SOURCES: displayedBillingItems = GetDisplayedDataWithThreeCostSources(); break; } if (_rowSummaryTotals.Count() > 0) { displayedCustomBillingData.SummaryPlannedTotals = _rowSummaryTotals[0].Text; displayedCustomBillingData.SummaryFirstPartyTotals = _rowSummaryTotals[1].Text; displayedCustomBillingData.SummaryActualTotals = _rowSummaryTotals[2].Text; } displayedCustomBillingData.CustomBillingItems = displayedBillingItems; return(displayedCustomBillingData); }
private void VerifyTotalsForSingleCostSource(CustomBillingData customBillingData, CustomBillingData displayedData) { Assert.AreEqual(customBillingData.CustomBillingItems.Count, displayedData.CustomBillingItems.Count, "Number of billing items displayed do not match test data."); foreach (var data in customBillingData.CustomBillingItems.Zip(displayedData.CustomBillingItems, Tuple.Create)) { Assert.AreEqual(data.Item1.Name, data.Item2.Name, $"Name does not match for {data.Item1.Name}"); Assert.AreEqual(data.Item1.PlannedTotals, data.Item2.PlannedTotals, $"Total planned do not match for {data.Item1.PlannedTotals}"); } }
private void VerifyTotalsForThreeCostSources(CustomBillingData customBillingData, CustomBillingData displayedData) { Assert.AreEqual(customBillingData.CustomBillingItems.Count, displayedData.CustomBillingItems.Count, "Number of billing items displayed do not match test data."); foreach (var data in customBillingData.CustomBillingItems.Zip(displayedData.CustomBillingItems, Tuple.Create)) { Assert.AreEqual(data.Item1.Name, data.Item2.Name, $"Names do not match"); Assert.AreEqual(data.Item1.ActualTotals, data.Item2.ActualTotals, $"Total actuals do not match for {data.Item1.Name}"); Assert.AreEqual(data.Item1.FirstPartyTotals, data.Item2.FirstPartyTotals, $"Total first party do not match for {data.Item1.Name}"); Assert.AreEqual(data.Item1.PlannedTotals, data.Item2.PlannedTotals, $"Total planned do not match for {data.Item1.Name}"); } if (string.IsNullOrEmpty(customBillingData.CurrencyType) || customBillingData.CurrencyType.Contains("Base") || !customBillingData.CurrencyType.Contains("Multiple")) { Assert.AreEqual(customBillingData.SummaryActualTotals, displayedData.SummaryActualTotals, "Summary actuals do not match"); Assert.AreEqual(customBillingData.SummaryFirstPartyTotals, displayedData.SummaryFirstPartyTotals, "Summary first party do not match"); Assert.AreEqual(customBillingData.SummaryPlannedTotals, displayedData.SummaryPlannedTotals, "Summary planned do not match"); } }