public void TestProfile()
        {
            Telescope.RegisterASCOM(typeof(Telescope));

            Utilities.Profile theProfile = new Utilities.Profile();
            theProfile.DeviceType = "Telescope";
            Assert.That(theProfile.IsRegistered(Telescope.ProgId));
            ObservationLocation.Reset();
            try
            {
                theProfile.DeleteValue(Telescope.ProgId, "Longitude", "");
            }
            catch (Exception) {}

            ObservationLocation theLocation = ObservationLocation.Location;

            Assert.That(theLocation.Longitude, Is.EqualTo(0.0));

            theProfile.WriteValue(Telescope.ProgId, "Longitude", Convert.ToString(4.12345), "");
            double longitude = Convert.ToDouble(theProfile.GetValue(Telescope.ProgId, "Longitude", ""));

            Assert.That(longitude, Is.EqualTo(4.12345));
            ObservationLocation.Reset();
            theLocation = ObservationLocation.Location;
            Assert.That(theLocation.Longitude, Is.EqualTo(4.12345));

            ObservationLocation.Reset();
            theProfile.DeleteValue(Telescope.ProgId, "Longitude", "");
            theLocation = ObservationLocation.Location;

            Assert.That(theLocation.Longitude, Is.EqualTo(0.0));
        }
        public void TestUTC()
        {
            ObservationLocation.Reset();
            ObservationLocation theLocation = ObservationLocation.Location;

            Assert.That(theLocation.UTC, Is.EqualTo(DateTime.UtcNow));

            NotifyHandler theHandler = new NotifyHandler(theLocation);
            DateTime      theDate    = DateTime.UtcNow;

            theLocation.UTC = theDate.AddHours(2);
            DateTime theNewDate = theLocation.UTC;

            Assert.That(theNewDate.Date, Is.EqualTo(theDate.Date));
            Assert.That(theNewDate.Hour, Is.EqualTo(theDate.Hour + 2));
            Assert.That(theNewDate.Second, Is.EqualTo(theDate.Second));
            Assert.That(theNewDate.Minute, Is.EqualTo(theDate.Minute));
            Assert.That(theHandler.nUtcChanges, Is.EqualTo(1));
        }
        public void TestLongitude()
        {
            Utilities.Profile theProfile = new Utilities.Profile();
            theProfile.DeviceType = "Telescope";

            theProfile.WriteValue(Telescope.ProgId, "Longitude", Convert.ToString(4.12345), "");
            ObservationLocation.Reset();
            ObservationLocation theLocation = ObservationLocation.Location;

            Assert.That(theLocation.Longitude, Is.EqualTo(4.12345).Within(0.00001));

            NotifyHandler theHandler = new NotifyHandler(theLocation);

            theLocation.Longitude = 12.54321;
            double storedLongitude = Convert.ToDouble(theProfile.GetValue(Telescope.ProgId, "Longitude", ""));

            Assert.That(theLocation.Longitude, Is.EqualTo(12.54321).Within(0.00001));
            Assert.That(storedLongitude, Is.EqualTo(12.54321).Within(0.00001));
            Assert.That(theHandler.nLongitudeChanges, Is.EqualTo(1));
        }