コード例 #1
0
        public void ProcessNewDiagnoseOutputEntry(IDiagnoseOutputEntry entry, long extraGap)
        {
            var output = DiagnoseOutputViewModels.SingleOrDefault(x => x.IsBracketOpen);

            if (output == null)
            {
                output = new DiagnoseOutputViewModel(entry, extraGap);
                if (entry.Type == DiagnoseType.EndBracketOutput)
                {
                    IsBracketOpen = false;
                    EndTimeStamp  = entry.TimeStamp;
                }
                else
                {
                    DiagnoseOutputViewModels.Add(output);
                }
            }
            else
            {
                output.ProcessNewDiagnoseOutputEntry(entry, extraGap);
            }
            if (output.IsBracketOpen)
            {
                TotalDuration = _totalDurationWithoutLastOpenBracketDiagnoseOutputViewModel +
                                output.GapExtraGapAndTotalDuration;
            }
            else
            {
                _totalDurationWithoutLastOpenBracketDiagnoseOutputViewModel += output.GapExtraGapAndTotalDuration;
                TotalDuration = _totalDurationWithoutLastOpenBracketDiagnoseOutputViewModel;
            }
        }
コード例 #2
0
 public void Constructor_Normal_DiagnoseOutputViewModelsNotNull()
 {
     var mock = new Mock<IDiagnoseOutputEntry>();
     mock.Setup(x => x.Type).Returns(DiagnoseType.SingleOutput);
     mock.Setup(x => x.Duration).Returns(1);
     mock.Setup(x => x.Gap).Returns(2);
     var diagnoseOutputViewModel = new DiagnoseOutputViewModel(mock.Object, 0);
     diagnoseOutputViewModel.DiagnoseOutputViewModels.Should().NotBeNull();
 }
コード例 #3
0
        public void ProcessNewDiagnoseOutputEntry_NewEntryStartBracketOutput_IsBracketOpen()
        {
            var mock = new Mock<IDiagnoseOutputEntry>();
            mock.Setup(x => x.Type).Returns(DiagnoseType.StartBracketOutput);
            mock.Setup(x => x.Duration).Returns(1);
            mock.Setup(x => x.Gap).Returns(2);

            var diagnoseViewModel = new DiagnoseOutputViewModel(mock.Object, 0);

            diagnoseViewModel.IsBracketOpen.Should().Be(true);
        }
コード例 #4
0
        public void ProcessNewDiagnoseOutputEntry_NewEntryWithLastAddedEntryIsBracketOpen_AddsDurationAndGapToTotalDiagnoseOutputViewModelDuration()
        {
            var mock = new Mock<IDiagnoseOutputEntry>();
            mock.Setup(x => x.Type).Returns(DiagnoseType.StartBracketOutput);
            mock.Setup(x => x.Duration).Returns(1);
            mock.Setup(x => x.Gap).Returns(2);

            var diagnoseViewModel = new DiagnoseOutputViewModel(mock.Object, 0);
            diagnoseViewModel.ProcessNewDiagnoseOutputEntry(mock.Object, 0);

            diagnoseViewModel.TotalDuration.Should().Be(4);
        }
コード例 #5
0
        public void ProcessNewDiagnoseOutputEntry(IDiagnoseOutputEntry entry)
        {
            var output = DiagnoseOutputViewModels.SingleOrDefault(x => x.IsBracketOpen);

            if (output == null)
            {
                output = new DiagnoseOutputViewModel(entry, TotalDuration - TotalDurationWithoutExtraGap);
                DiagnoseOutputViewModels.Add(output);
            }
            else
            {
                output.ProcessNewDiagnoseOutputEntry(entry, TotalDuration - TotalDurationWithoutExtraGap);
            }

            if (output.IsBracketOpen)
            {
                TotalDurationWithoutExtraGap = TotalDuration = _totalDurationWithoutLastOpenBracketDiagnoseOutputViewModel + output.GapExtraGapAndTotalDuration;
            }
            else
            {
                _totalDurationWithoutLastOpenBracketDiagnoseOutputViewModel += output.GapExtraGapAndTotalDuration;
                TotalDurationWithoutExtraGap = TotalDuration = _totalDurationWithoutLastOpenBracketDiagnoseOutputViewModel;
            }
        }
コード例 #6
0
        public void ProcessNewDiagnoseOutputEntry_NewEntryWithStartBracketOutputEndBracketOutput_IsNotBracketOpen()
        {
            var mock1 = new Mock<IDiagnoseOutputEntry>();
            mock1.Setup(x => x.Type).Returns(DiagnoseType.StartBracketOutput);
            mock1.Setup(x => x.Duration).Returns(1);
            mock1.Setup(x => x.Gap).Returns(2);
            var mock2 = new Mock<IDiagnoseOutputEntry>();
            mock2.Setup(x => x.Type).Returns(DiagnoseType.EndBracketOutput);
            mock2.Setup(x => x.Duration).Returns(1);
            mock2.Setup(x => x.Gap).Returns(2);

            var diagnoseViewModel = new DiagnoseOutputViewModel(mock1.Object, 0);
            diagnoseViewModel.ProcessNewDiagnoseOutputEntry(mock2.Object, 0);

            diagnoseViewModel.IsBracketOpen.Should().Be(false);
        }
コード例 #7
0
        public void ProcessNewDiagnoseOutputEntry(IDiagnoseOutputEntry entry)
        {
            var output = DiagnoseOutputViewModels.SingleOrDefault(x => x.IsBracketOpen);

            if (output == null)
            {
                output = new DiagnoseOutputViewModel(entry, TotalDuration - TotalDurationWithoutExtraGap);
                DiagnoseOutputViewModels.Add(output);
            }
            else
            {
                output.ProcessNewDiagnoseOutputEntry(entry, TotalDuration - TotalDurationWithoutExtraGap);
            }

            if(output.IsBracketOpen)
            {
                TotalDurationWithoutExtraGap = TotalDuration = _totalDurationWithoutLastOpenBracketDiagnoseOutputViewModel + output.GapExtraGapAndTotalDuration;
            }
            else
            {
                _totalDurationWithoutLastOpenBracketDiagnoseOutputViewModel += output.GapExtraGapAndTotalDuration;
                TotalDurationWithoutExtraGap = TotalDuration = _totalDurationWithoutLastOpenBracketDiagnoseOutputViewModel;
            }
        }
コード例 #8
0
        public void ProcessNewDiagnoseOutputEntry(IDiagnoseOutputEntry entry, long extraGap)
        {
            var output = DiagnoseOutputViewModels.SingleOrDefault(x => x.IsBracketOpen);

            if (output == null)
            {
                output = new DiagnoseOutputViewModel(entry, extraGap);
                if (entry.Type == DiagnoseType.EndBracketOutput)
                {
                    IsBracketOpen = false;
                    EndTimeStamp = entry.TimeStamp;
                }
                else
                {
                    DiagnoseOutputViewModels.Add(output);
                }
            }
            else
            {
                output.ProcessNewDiagnoseOutputEntry(entry, extraGap);
            }
            if (output.IsBracketOpen)
            {
                TotalDuration = _totalDurationWithoutLastOpenBracketDiagnoseOutputViewModel +
                                output.GapExtraGapAndTotalDuration;
            }
            else
            {
                _totalDurationWithoutLastOpenBracketDiagnoseOutputViewModel += output.GapExtraGapAndTotalDuration;
                TotalDuration = _totalDurationWithoutLastOpenBracketDiagnoseOutputViewModel;
            }
        }