public void Test_InterfaceValidations()
        {
            Assert.IsFalse(device.Connected);
            Assert.IsNotNull(device.RightAscension);
            Assert.IsNotNull(device.Declination);
            Assert.IsNotNull(device.SiteLongitude);
            Assert.IsNotNull(device.SiteLatitude);
            Assert.IsNotNull(device.SiteElevation);
            Assert.IsNotNull(device.SideOfPier);

            device.Connected = true;
            Assert.IsTrue(device.Connected);

            //Assert.ThrowsException<ASCOM.InvalidOperationException>(() => device.SiteLongitude);
            //Assert.ThrowsException<ASCOM.InvalidOperationException>(() => device.SiteLatitude);
            //Assert.ThrowsException<ASCOM.InvalidOperationException>(() => device.SiteElevation);

            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.SiteLongitude = -181);
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.SiteLongitude = +181);
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.SiteLatitude  = -91);
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.SiteLatitude  = +91);
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.SiteElevation = -301);
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.SiteElevation = +10001);

            Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.TargetDeclination);
            Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.TargetRightAscension);

            Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.Tracking = true);

            Assert.AreEqual(DriveRates.driveSidereal, device.TrackingRate);
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.TrackingRate = DriveRates.driveKing);
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.TrackingRate = DriveRates.driveLunar);
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.TrackingRate = DriveRates.driveSolar);

            Assert.ThrowsException <ASCOM.MethodNotImplementedException>(() => device.DestinationSideOfPier(0, 0));
        }
        public void TestDriverSupportedFeatures()
        {
            using (var device = new ASCOM.DriverAccess.Telescope("ASCOM.EQ500X.Telescope"))
            {
                Assert.AreEqual(0, device.SupportedActions.Count);

                /* Moving */
                //Assert.ThrowsException<ASCOM.NotConnectedException>(() => device.MoveAxis(TelescopeAxes.axisPrimary, 0));
                //Assert.ThrowsException<ASCOM.NotConnectedException>(() => device.MoveAxis(TelescopeAxes.axisSecondary, 0));
                Assert.IsTrue(device.CanMoveAxis(TelescopeAxes.axisPrimary));
                Assert.IsTrue(device.CanMoveAxis(TelescopeAxes.axisSecondary));
                Assert.IsFalse(device.CanMoveAxis(TelescopeAxes.axisTertiary));

                /* Tracking */
                Assert.IsFalse(device.CanSetDeclinationRate);
                Assert.IsFalse(device.CanSetRightAscensionRate);
                Assert.IsFalse(device.CanSetTracking);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.DeclinationRate);
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.DeclinationRate = 0);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.RightAscensionRate);
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.RightAscensionRate = 0);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.Tracking);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.Tracking = false);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.TrackingRate);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.TrackingRate = DriveRates.driveSidereal);

                /* Slewing */
                Assert.IsTrue(device.CanSlew);
                Assert.IsFalse(device.CanSlewAltAz);
                Assert.IsFalse(device.CanSlewAltAzAsync);
                Assert.IsTrue(device.CanSlewAsync);
                //Assert.ThrowsException<ASCOM.MethodNotImplementedException>(device.AbortSlew);
                Assert.ThrowsException <ASCOM.MethodNotImplementedException>(() => device.SlewToAltAz(0, 0));
                Assert.ThrowsException <ASCOM.MethodNotImplementedException>(() => device.SlewToAltAzAsync(0, 0));
                //Assert.ThrowsException<ASCOM.MethodNotImplementedException>(() => device.SlewToCoordinates(0, 0));
                //Assert.ThrowsException<ASCOM.MethodNotImplementedException>(() => device.SlewToCoordinatesAsync(0, 0));
                //Assert.ThrowsException<ASCOM.MethodNotImplementedException>(device.SlewToTarget);
                //Assert.ThrowsException<ASCOM.MethodNotImplementedException>(device.SlewToTargetAsync);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.Slewing);
                Assert.ThrowsException <ASCOM.MethodNotImplementedException>(() => device.DestinationSideOfPier(0, 0));
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.SlewSettleTime);
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.SlewSettleTime = 0);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.TargetDeclination);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.TargetDeclination = 0);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.TargetRightAscension);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.TargetRightAscension = 0);

                /* Parking */
                Assert.IsFalse(device.CanFindHome);
                Assert.IsFalse(device.CanPark);
                Assert.IsFalse(device.CanSetPark);
                Assert.ThrowsException <ASCOM.MethodNotImplementedException>(device.FindHome);
                Assert.ThrowsException <ASCOM.MethodNotImplementedException>(device.FindHome);
                Assert.ThrowsException <ASCOM.MethodNotImplementedException>(device.SetPark);
                Assert.ThrowsException <ASCOM.MethodNotImplementedException>(device.Unpark);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.AtHome);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.AtPark);

                /* Guiding */
                Assert.IsTrue(device.CanPulseGuide);
                Assert.IsFalse(device.CanSetGuideRates);
                //Assert.ThrowsException<ASCOM.MethodNotImplementedException>(() => device.PulseGuide(GuideDirections.guideEast, 0));
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.GuideRateDeclination);
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.GuideRateDeclination = 0);
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.GuideRateRightAscension);
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.GuideRateRightAscension = 0);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.IsPulseGuiding);

                /* Optical */
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.ApertureArea);
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.ApertureDiameter);
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.ApertureArea);
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.DoesRefraction);
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.DoesRefraction = false);
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.FocalLength);
            }
        }
Exemple #3
0
 public PierSide DestinationSideOfPier(double RightAscension, double Declination)
 {
     CheckConnected();
     return(m_mount.DestinationSideOfPier(RightAscension, Declination));
 }