public void ImageHistory_LimitedStack_FullConcurrency_Test() { var sut = new ImageHistoryVM(profileServiceMock.Object); Parallel.For(0, 300, (i) => { sut.Add(new StarDetectionAnalysis() { DetectedStars = i, HFR = i }); sut.AppendAutoFocusPoint(new NINA.ViewModel.AutoFocus.AutoFocusReport()); }); sut.LimitedImageHistoryStack.Count.Should().Be(100); sut.AutoFocusPoints.Select(x => x.Id).Distinct().ToList().Count.Should().BeLessOrEqualTo(100); sut.ImageHistory.Count.Should().Be(300); }
public void ImageHistory_ConcurrentId_Order_Test() { var sut = new ImageHistoryVM(profileServiceMock.Object); Parallel.For(0, 100, (i) => { sut.Add(new StarDetectionAnalysis() { DetectedStars = i, HFR = i }); }); for (int i = 0; i < 100; i++) { sut.ImageHistory[i].Id.Should().Be(i + 1); } }
public void ImageHistory_Value_Test() { var sut = new ImageHistoryVM(profileServiceMock.Object); var hfr = 10.1234; var stars = 12323; sut.Add(new StarDetectionAnalysis() { DetectedStars = stars, HFR = hfr }); sut.LimitedImageHistoryStack.First().Value.HFR.Should().Be(hfr); sut.LimitedImageHistoryStack.First().Value.DetectedStars.Should().Be(stars); sut.ImageHistory[0].HFR.Should().Be(hfr); sut.ImageHistory[0].DetectedStars.Should().Be(stars); }
public void ImageHistory_LimitedStack_Concurrency_Test() { var sut = new ImageHistoryVM(profileServiceMock.Object); for (int i = 0; i < 1000; i++) { sut.Add(new StarDetectionAnalysis() { DetectedStars = i, HFR = i }); sut.AppendAutoFocusPoint(new NINA.ViewModel.AutoFocus.AutoFocusReport()); } sut.LimitedImageHistoryStack.Count.Should().Be(100); sut.AutoFocusPoints.Count.Should().Be(100); sut.ImageHistory.Count.Should().Be(1000); }
public void ImageHistory_ClearPlot_Test() { var sut = new ImageHistoryVM(profileServiceMock.Object); Parallel.For(0, 100, (i) => { sut.Add(new StarDetectionAnalysis() { DetectedStars = i, HFR = i }); sut.AppendAutoFocusPoint(new NINA.ViewModel.AutoFocus.AutoFocusReport()); }); sut.PlotClear(); sut.LimitedImageHistoryStack.Count.Should().Be(0); sut.AutoFocusPoints.Count.Should().Be(0); sut.ImageHistory.Count.Should().Be(100); }