コード例 #1
0
ファイル: CaptureSequenceTest.cs プロジェクト: daleghent/NINA
        public void GetNextSequence_ModeRotateOneDisabled_FirstEmptySecondDisabledThirdSelected()
        {
            //Arrange
            var seq = new CaptureSequence()
            {
                ProgressExposureCount = 0, TotalExposureCount = 0
            };
            var seq2 = new CaptureSequence()
            {
                ProgressExposureCount = 5, TotalExposureCount = 10, Enabled = false
            };
            var seq3 = new CaptureSequence()
            {
                ProgressExposureCount = 5, TotalExposureCount = 7
            };
            var l = new CaptureSequenceList();

            l.Mode = SequenceMode.ROTATE;

            l.Add(seq);
            l.Add(seq2);
            l.Add(seq3);

            //Act
            var actual = l.Next();

            //Assert
            Assert.AreSame(seq3, actual);
        }
コード例 #2
0
ファイル: CaptureSequenceTest.cs プロジェクト: daleghent/NINA
        public void GetNextSequence_ModeRotate_AllFinished()
        {
            //Arrange
            var seq = new CaptureSequence()
            {
                TotalExposureCount = 5
            };
            var seq2 = new CaptureSequence()
            {
                TotalExposureCount = 5
            };
            var seq3 = new CaptureSequence()
            {
                TotalExposureCount = 5
            };
            var l = new CaptureSequenceList();

            l.Mode = SequenceMode.ROTATE;

            l.Add(seq);
            l.Add(seq2);
            l.Add(seq3);

            //Act
            CaptureSequence actualSeq;

            while ((actualSeq = l.Next()) != null)
            {
            }

            //Assert
            Assert.AreEqual(null, l.ActiveSequence);
            Assert.AreEqual(-1, l.ActiveSequenceIndex);
            Assert.AreEqual(0, l.Items.Where(x => x.ProgressExposureCount <x.TotalExposureCount || x.ProgressExposureCount> x.TotalExposureCount).Count());
        }
コード例 #3
0
ファイル: CaptureSequenceTest.cs プロジェクト: daleghent/NINA
        public void DeleteSequenceDuringPause_NextItemSelected()
        {
            var seq = new CaptureSequence()
            {
                ProgressExposureCount = 0, TotalExposureCount = 5
            };
            var seq2 = new CaptureSequence()
            {
                TotalExposureCount = 10
            };

            var l = new CaptureSequenceList();

            l.Add(seq);

            l.Next();
            l.Next();
            l.Next();

            l.RemoveAt(l.ActiveSequenceIndex - 1);

            l.Add(seq2);

            Assert.AreEqual(seq2, l.ActiveSequence);
        }
コード例 #4
0
ファイル: CaptureSequenceTest.cs プロジェクト: daleghent/NINA
        public void GetNextSequence_ModeRotate_NextSequenceSelected()
        {
            //Arrange
            var seq = new CaptureSequence()
            {
                TotalExposureCount = 5
            };
            var seq2 = new CaptureSequence()
            {
                TotalExposureCount = 5
            };
            var seq3 = new CaptureSequence()
            {
                TotalExposureCount = 5
            };
            var l = new CaptureSequenceList();

            l.Mode = SequenceMode.ROTATE;

            l.Add(seq);
            l.Add(seq2);
            l.Add(seq3);

            //Act
            var actualFirst  = l.Next();
            var actualSecond = l.Next();
            var actualThird  = l.Next();
            var actualFourth = l.Next();

            //Assert
            Assert.AreSame(seq, actualFirst, "First wrong");
            Assert.AreSame(seq2, actualSecond, "Second wrong");
            Assert.AreSame(seq3, actualThird, "Third wrong");
            Assert.AreSame(seq, actualFourth, "Fourth wrong");
        }
コード例 #5
0
ファイル: CaptureSequenceTest.cs プロジェクト: daleghent/NINA
        public void DisableSequenceDuringPause_ModeRotate_NextItemSelected()
        {
            var seq = new CaptureSequence()
            {
                ProgressExposureCount = 0, TotalExposureCount = 5
            };
            var seq2 = new CaptureSequence()
            {
                TotalExposureCount = 10
            };

            var l = new CaptureSequenceList();

            l.Mode = SequenceMode.ROTATE;
            l.Add(seq);

            l.Next();
            l.Next();
            l.Next();

            l.Items[l.ActiveSequenceIndex - 1].Enabled = false;

            l.Add(seq2);

            Assert.AreEqual(seq2, l.ActiveSequence);
        }
コード例 #6
0
ファイル: CaptureSequenceTest.cs プロジェクト: daleghent/NINA
        public void GetNextSequence_ModeStandardOneDisabled_Initial()
        {
            //Arrange
            var seq  = new CaptureSequence();
            var seq2 = new CaptureSequence()
            {
                Enabled = false
            };
            var l = new CaptureSequenceList();

            l.Mode = SequenceMode.STANDARD;
            l.Add(seq);
            l.Add(seq2);

            //Act
            var nextSeq = l.Next();

            //Assert
            Assert.AreEqual(string.Empty, l.TargetName, "Targetname");
            Assert.AreSame(seq, nextSeq);
            Assert.AreEqual(1, l.Count);
            Assert.AreSame(seq, l.ActiveSequence);
            Assert.AreEqual(1, l.ActiveSequenceIndex);
            Assert.AreEqual(0, l.Delay);
        }
コード例 #7
0
ファイル: CaptureSequenceTest.cs プロジェクト: daleghent/NINA
        public void GetNextSequence_ModeStandardOneDisabled_NextSequenceSelectedShouldBeEmpty()
        {
            //Arrange
            var seq = new CaptureSequence()
            {
                TotalExposureCount = 2
            };
            var seq2 = new CaptureSequence()
            {
                Enabled = false
            };
            var l = new CaptureSequenceList();

            l.Mode = SequenceMode.STANDARD;
            l.Add(seq);
            l.Add(seq2);

            //Act
            var nextSeq = l.Next();

            nextSeq = l.Next();
            nextSeq = l.Next();

            //Assert
            Assert.AreEqual(string.Empty, l.TargetName, "Targetname");
            Assert.AreSame(null, nextSeq);
            Assert.AreEqual(1, l.Count);
            Assert.AreSame(null, l.ActiveSequence);
            Assert.AreEqual(-1, l.ActiveSequenceIndex);
            Assert.AreEqual(0, l.Delay);
        }
コード例 #8
0
ファイル: CaptureSequenceTest.cs プロジェクト: daleghent/NINA
        public void CoordinatesTest_SetCoordinates_RaDecPartialsEqualCoordinates()
        {
            var l           = new CaptureSequenceList();
            var coordinates = new NINA.Utility.Astrometry.Coordinates(10, 10, NINA.Utility.Astrometry.Epoch.J2000, NINA.Utility.Astrometry.Coordinates.RAType.Hours);

            l.Coordinates = coordinates.Transform(NINA.Utility.Astrometry.Epoch.J2000);

            Assert.AreEqual(coordinates.RA, l.RAHours + l.RAMinutes + l.RASeconds);
            Assert.AreEqual(coordinates.Dec, l.DecDegrees + l.DecMinutes + l.DecSeconds);
        }
コード例 #9
0
ファイル: CaptureSequenceTest.cs プロジェクト: daleghent/NINA
        public void SetTargetName_ValueTest()
        {
            //Arrange
            var l      = new CaptureSequenceList();
            var target = "Messier 31";

            //Act
            l.TargetName = target;

            //Assert
            Assert.AreEqual(target, l.TargetName);
        }
コード例 #10
0
ファイル: CaptureSequenceTest.cs プロジェクト: daleghent/NINA
        public void SetDelay_ValueTest()
        {
            //Arrange
            var l     = new CaptureSequenceList();
            var delay = 5213;

            //Act
            l.Delay = delay;

            //Assert
            Assert.AreEqual(delay, l.Delay);
        }
コード例 #11
0
ファイル: SequenceVMTest.cs プロジェクト: daleghent/NINA
        public void SequenceVM_TestInit()
        {
            profileServiceMock = new Mock <IProfileService>();
            profileServiceMock.SetupProperty(m => m.ActiveProfile.ImageFileSettings.FilePath, TestContext.CurrentContext.TestDirectory);
            profileServiceMock.SetupProperty(m => m.ActiveProfile.SequenceSettings.TemplatePath, TestContext.CurrentContext.TestDirectory);
            profileServiceMock.SetupProperty(m => m.ActiveProfile.AstrometrySettings.Longitude, 0);
            profileServiceMock.SetupProperty(m => m.ActiveProfile.AstrometrySettings.Latitude, 0);
            profileServiceMock.SetupProperty(m => m.ActiveProfile.FocuserSettings.AutoFocusDisableGuiding, true);

            cameraMediatorMock            = new Mock <ICameraMediator>();
            telescopeMediatorMock         = new Mock <ITelescopeMediator>();
            focuserMediatorMock           = new Mock <IFocuserMediator>();
            filterWheelMediatorMock       = new Mock <IFilterWheelMediator>();
            guiderMediatorMock            = new Mock <IGuiderMediator>();
            rotatorMediatorMock           = new Mock <IRotatorMediator>();
            flatDeviceMediatorMock        = new Mock <IFlatDeviceMediator>();
            weatherDataMediatorMock       = new Mock <IWeatherDataMediator>();
            imagingMediatorMock           = new Mock <IImagingMediator>();
            applicationStatusMediatorMock = new Mock <IApplicationStatusMediator>();

            _dummyList = new CaptureSequenceList();
            _dummyList.Add(new CaptureSequence()
            {
                TotalExposureCount = 10
            });
            _dummyList.Add(new CaptureSequence()
            {
                TotalExposureCount = 20
            });
            _dummyList.Add(new CaptureSequence()
            {
                TotalExposureCount = 5
            });

            _flatDevice = new FlatDeviceInfo()
            {
                Brightness        = 1.0,
                Connected         = true,
                CoverState        = CoverState.Open,
                Description       = "Some description",
                DriverInfo        = "Some driverInfo",
                LightOn           = false,
                DriverVersion     = "200",
                MaxBrightness     = 255,
                MinBrightness     = 0,
                Name              = "Some name",
                SupportsOpenClose = true
            };

            _sut = new SequenceVM(profileServiceMock.Object, cameraMediatorMock.Object, telescopeMediatorMock.Object, focuserMediatorMock.Object,
                                  filterWheelMediatorMock.Object, guiderMediatorMock.Object, rotatorMediatorMock.Object, flatDeviceMediatorMock.Object,
                                  weatherDataMediatorMock.Object, imagingMediatorMock.Object, applicationStatusMediatorMock.Object);
        }
コード例 #12
0
ファイル: CaptureSequenceTest.cs プロジェクト: daleghent/NINA
        public void AddFirstSequence_ActiveSequenceSet()
        {
            var seq = new CaptureSequence()
            {
                ProgressExposureCount = 0, TotalExposureCount = 5
            };

            var l = new CaptureSequenceList();

            l.Add(seq);

            Assert.AreEqual(seq, l.ActiveSequence);
        }
コード例 #13
0
ファイル: CaptureSequenceTest.cs プロジェクト: daleghent/NINA
        [TestCase(-89, 59, 59, -89.99972222222222)] //high bound
        //[TestCase(90, 0, 1, 90)] //overflow
        //[TestCase(-90, 0, 1, 90)] //overflow
        public void CoordinatesTest_ManualInput_DecCheck(int decDegrees, int decMinutes, int decSeconds, double expected)
        {
            var l           = new CaptureSequenceList();
            var coordinates = new NINA.Utility.Astrometry.Coordinates(0, 0, NINA.Utility.Astrometry.Epoch.J2000, NINA.Utility.Astrometry.Coordinates.RAType.Hours);

            l.DecDegrees = decDegrees;
            l.DecMinutes = decMinutes;
            l.DecSeconds = decSeconds;

            Assert.AreEqual(expected, l.Coordinates.Dec, 0.000001, "Coordinates failed");
            Assert.AreEqual(decDegrees, l.DecDegrees, 0.000001, "Degrees failed");
            Assert.AreEqual(Math.Abs(decMinutes), l.DecMinutes, 0.000001, "Minutes failed");
            Assert.AreEqual(Math.Abs(decSeconds), l.DecSeconds, 0.000001, "Seconds failed");
        }
コード例 #14
0
ファイル: CaptureSequenceTest.cs プロジェクト: daleghent/NINA
        [TestCase(0, 0, 0, 0)]                    //Lowest bound
        //[TestCase(24, 0, 0, 0)] //Overflow
        //[TestCase(0, 0, -1, 0)] //Overflow
        public void CoordinatesTest_ManualInput_RACheck(int raHours, int raMinutes, int raSeconds, double expected)
        {
            var l           = new CaptureSequenceList();
            var coordinates = new NINA.Utility.Astrometry.Coordinates(0, 0, NINA.Utility.Astrometry.Epoch.J2000, NINA.Utility.Astrometry.Coordinates.RAType.Hours);

            l.RAHours   = raHours;
            l.RAMinutes = raMinutes;
            l.RASeconds = raSeconds;

            Assert.AreEqual(expected, l.Coordinates.RA, 0.000001, "Coordinates failed");
            Assert.AreEqual(raHours, l.RAHours, 0.000001, "Hours failed");
            Assert.AreEqual(raMinutes, l.RAMinutes, 0.000001, "Minutes failed");
            Assert.AreEqual(raSeconds, l.RASeconds, 0.000001, "Seconds failed");
        }
コード例 #15
0
ファイル: CaptureSequenceTest.cs プロジェクト: daleghent/NINA
        public void DefaultConstructor_ValueTest()
        {
            //Arrange
            var l = new CaptureSequenceList();

            //Act

            //Assert
            Assert.AreEqual(string.Empty, l.TargetName, "Targetname");
            Assert.AreEqual(0, l.Count);
            Assert.AreEqual(null, l.ActiveSequence);
            Assert.AreEqual(-1, l.ActiveSequenceIndex);
            Assert.AreEqual(0, l.Delay);
        }
コード例 #16
0
ファイル: CaptureSequenceTest.cs プロジェクト: daleghent/NINA
        public void GetNextSequence_ModeRotate_EmptyListNextNull()
        {
            //Arrange
            var l = new CaptureSequenceList();

            l.Mode = SequenceMode.ROTATE;

            //Act
            var actual = l.Next();

            //Assert
            Assert.AreSame(null, actual);
            Assert.AreEqual(null, l.ActiveSequence);
            Assert.AreEqual(-1, l.ActiveSequenceIndex);
        }
コード例 #17
0
ファイル: CaptureSequenceTest.cs プロジェクト: daleghent/NINA
        public void AddFirstSequenceAfterOneDisabledExists_ActiveSequenceSet()
        {
            var seq = new CaptureSequence()
            {
                ProgressExposureCount = 0, TotalExposureCount = 5, Enabled = false
            };
            var seq2 = new CaptureSequence()
            {
                TotalExposureCount = 10
            };
            var l = new CaptureSequenceList();

            l.Add(seq);
            l.Add(seq2);

            Assert.AreEqual(seq2, l.ActiveSequence);
        }
コード例 #18
0
ファイル: CaptureSequenceTest.cs プロジェクト: daleghent/NINA
        public void GetNextSequence_ModeRotateOneDisabled_EmptyListNextNull()
        {
            //Arrange
            var seq = new CaptureSequence()
            {
                TotalExposureCount = 5, Enabled = false
            };
            var l = new CaptureSequenceList();

            l.Mode = SequenceMode.ROTATE;
            l.Add(seq);

            //Act
            var actual = l.Next();

            //Assert
            Assert.AreSame(null, actual);
            Assert.AreEqual(null, l.ActiveSequence);
            Assert.AreEqual(-1, l.ActiveSequenceIndex);
        }
コード例 #19
0
ファイル: CaptureSequenceTest.cs プロジェクト: daleghent/NINA
        public void RunSequenceMultipleTimes_ModeRotate_NumberOfExposuresCorrect()
        {
            var seq1 = new CaptureSequence()
            {
                TotalExposureCount = 50
            };
            var seq2 = new CaptureSequence()
            {
                TotalExposureCount = 10
            };
            var seq3 = new CaptureSequence()
            {
                TotalExposureCount = 30
            };

            var l = new CaptureSequenceList();

            l.Mode = SequenceMode.ROTATE;
            l.Add(seq1);

            while (l.Next() != null)
            {
            }

            l.Add(seq2);

            while (l.Next() != null)
            {
            }

            l.Add(seq3);

            while (l.Next() != null)
            {
            }

            Assert.AreEqual(50, seq1.ProgressExposureCount);
            Assert.AreEqual(10, seq2.ProgressExposureCount);
            Assert.AreEqual(30, seq3.ProgressExposureCount);
        }
コード例 #20
0
ファイル: CaptureSequenceTest.cs プロジェクト: daleghent/NINA
        public void GetNextSequence_ModeStandardOneDisabled_AllFinished()
        {
            //Arrange
            var seq = new CaptureSequence()
            {
                TotalExposureCount = 5
            };
            var seq2 = new CaptureSequence()
            {
                ProgressExposureCount = 0, TotalExposureCount = 5, Enabled = false
            };
            var seq3 = new CaptureSequence()
            {
                TotalExposureCount = 5
            };
            var l = new CaptureSequenceList();

            l.Mode = SequenceMode.STANDARD;

            l.Add(seq);
            l.Add(seq2);
            l.Add(seq3);

            //Act
            CaptureSequence actualSeq;

            while ((actualSeq = l.Next()) != null)
            {
            }

            //Assert
            Assert.AreEqual(null, l.ActiveSequence);
            Assert.AreEqual(-1, l.ActiveSequenceIndex);
            Assert.AreEqual(1, l.Items.Where(x => x.ProgressExposureCount < x.TotalExposureCount).Count());
            Assert.AreEqual(5, seq.ProgressExposureCount);
            Assert.AreEqual(0, seq2.ProgressExposureCount);
            Assert.AreEqual(5, seq3.ProgressExposureCount);
        }