public void ShouldPassCorrectInputValuesToTheCalculatorWhenSuccessfulyLoadData() { ScatterInputData actualInputData = null; var expectedInputData = new ScatterInputData { Data = new[] { new Dictionary <string, double> { { "seven", 0.00052 }, { "eight", 1.000012 }, { "nine", 1.1 } }, new Dictionary <string, double> { { "seven", 0.0000010101 }, { "eight", 0.12456 }, { "nine", 1.2 } } }, AbscissaColumnName = "seven", OrdinateColumnName = "eight" }; var dataResult = DataResult.CreateSuccessful(expectedInputData.Data); FakeProvider.GetFrom(null).ReturnsForAnyArgs(dataResult); var dummyReportData = new ScatterReportData(Enumerable.Empty <ScatterPoint>(), new ScatterLine(new ScatterPoint(), new ScatterPoint())); FakeScatterReportCalculator.Calculate(Arg.Do <ScatterInputData>(input => actualInputData = input)).ReturnsForAnyArgs(dummyReportData); ViewModel.LoadDataCommand.Execute("dummy.path"); SelectColumnsForReport("seven", "eight"); ViewModel.GenerateReportDataCommand.Execute(null); actualInputData.ShouldBeEquivalentTo(expectedInputData); }
public void ShouldResetReportData() { var inputData = new ScatterInputData { Data = new[] { new Dictionary <string, double> { { "seven", 0.00052 }, { "eight", 1.000012 }, { "nine", 1.1 } }, new Dictionary <string, double> { { "seven", 0.0000010101 }, { "eight", 0.12456 }, { "nine", 1.2 } } }, AbscissaColumnName = "seven", OrdinateColumnName = "eight" }; var dataResult = DataResult.CreateSuccessful(inputData.Data); FakeProvider.GetFrom(null).ReturnsForAnyArgs(dataResult); var dummyReportData = GenerateDummyReportData(); FakeScatterReportCalculator.Calculate(null).ReturnsForAnyArgs(dummyReportData); ViewModel.LoadDataCommand.Execute("dummy.path"); var(abscissaColumn, ordinateColumn) = SelectColumnsForReport("seven", "nine"); ViewModel.GenerateReportDataCommand.Execute(null); ViewModel.LoadDataCommand.Execute("dummy2.path"); ViewModel.Report.ShouldBeEquivalentTo(ScatterReportData.Empty); }
public void ShouldUpdateReportData() { var plotPoints = new[] { new ScatterPoint(1.23, 1.9), new ScatterPoint(1.59, 24.5), new ScatterPoint(0.5, 15), }; var trendLine = new ScatterLine(new ScatterPoint(1, 12.12), new ScatterPoint(2, 16.34)); var reportData = new ScatterReportData(plotPoints, trendLine); FakeScatterReportCalculator.Calculate(Arg.Any <ScatterInputData>()).Returns(reportData); ViewModel.GenerateReportDataCommand.Execute(null); ViewModel.Report.ShouldBeEquivalentTo(reportData); }
public void ShouldRaisePropertyChangedForReportDataCollection() { var plotPoints = new[] { new ScatterPoint(1, 2), new ScatterPoint(42, 22), new ScatterPoint(2, 3), }; var trendLine = new ScatterLine(new ScatterPoint(1, 4), new ScatterPoint(32, 22)); var reportData = new ScatterReportData(plotPoints, trendLine); FakeScatterReportCalculator.Calculate(Arg.Any <ScatterInputData>()).Returns(reportData); ViewModel.MonitorEvents(); ViewModel.GenerateReportDataCommand.Execute(null); ViewModel.ShouldRaisePropertyChangeFor(viewmodel => viewmodel.ReportDataCollection); }
public void ShouldRaisePropertyChangedForReportData() { var plotPoints = new[] { new ScatterPoint(1.23, 1.9), new ScatterPoint(1.59, 24.5), new ScatterPoint(0.5, 15), }; var trendLine = new ScatterLine(new ScatterPoint(1, 12.12), new ScatterPoint(2, 16.34)); var reportData = new ScatterReportData(plotPoints, trendLine); FakeScatterReportCalculator.Calculate(Arg.Any <ScatterInputData>()).Returns(reportData); ViewModel.MonitorEvents(); ViewModel.GenerateReportDataCommand.Execute(null); ViewModel.ShouldRaisePropertyChangeFor(viewmodel => viewmodel.Report); }
public void ShouldContainCalculatedTrendLine() { var plotPoints = new[] { new ScatterPoint(1.0, 0.20), new ScatterPoint(4.2, 0.22), new ScatterPoint(2.0, 1.31), }; var trendLine = new ScatterLine(new ScatterPoint(1, 4), new ScatterPoint(32, 22)); var reportData = new ScatterReportData(plotPoints, trendLine); FakeScatterReportCalculator.Calculate(Arg.Any <ScatterInputData>()).Returns(reportData); ViewModel.GenerateReportDataCommand.Execute(null); var actualLine = ViewModel.ReportDataCollection.OfType <ScatterLine>().First(); actualLine.ShouldBeEquivalentTo(trendLine); }
public void ShouldContainAllCalculatedPlotPoints() { var plotPoints = new[] { new ScatterPoint(1, 2), new ScatterPoint(42, 22), new ScatterPoint(2, 3), }; var trendLine = new ScatterLine(new ScatterPoint(1, 4), new ScatterPoint(32, 22)); var reportData = new ScatterReportData(plotPoints, trendLine); FakeScatterReportCalculator.Calculate(Arg.Any <ScatterInputData>()).Returns(reportData); ViewModel.GenerateReportDataCommand.Execute(null); var actualPoints = ViewModel.ReportDataCollection.OfType <ScatterPoint>(); actualPoints.ShouldBeEquivalentTo(plotPoints); }