Exemple #1
0
        public void GetGPSCoordsDecimalDegrees()
        {
            GPSCoords degreeTest = new GPSCoords(-37.788047M, 175.310512M,"argis");

            Assert.AreEqual(-37.788047M, degreeTest.DecimalDegreesLatitude);
            Assert.AreEqual(175.310512M, degreeTest.DecimalDegreesLongitude);
        }
Exemple #2
0
        } // Necessary for serialisation.

        /// <summary>
        /// Creates a new Site.
        /// </summary>
        /// <param name="iD">The unique ID field of the Site</param>
        /// <param name="name">The name of this site</param>
        /// <param name="owner">The name of the owner of the Site</param>
        /// <param name="primaryContact">The details of the primary contact</param>
        /// <param name="secondaryContact">The details of the secondary contact</param>
        /// <param name="gpsLocation">The GPS coordinates of the Site</param>
        public Site(int iD, string name, string owner, Contact primaryContact, Contact secondaryContact, GPSCoords gpsLocation)
        {
            if (iD < 0)
            {
                throw new ArgumentException("ID number must a non-negative integer");
            }
            if (String.IsNullOrEmpty(name))
            {
                throw new ArgumentException("Site must not be empty");
            }

            /*if(String.IsNullOrEmpty(owner))
             *  throw new ArgumentException("Owner must not be empty");
             * if(primaryContact == null)
             *  throw new ArgumentException("Primary contact must not be null");
             * if(gpsLocation == null)
             *  throw new ArgumentException("GPS Location must be supplied");*/

            _iD               = iD;
            _name             = name;
            _owner            = owner;
            _primaryContact   = primaryContact;
            _secondaryContact = secondaryContact;
            _gpsLocation      = gpsLocation;
            Events            = new List <Event>();
        }
Exemple #3
0
        public void EqualityTest()
        {
            var A = new GPSCoords(4, 17, "argis");
            var B = new GPSCoords(4, 17, "argis");

            Assert.AreEqual(A, B);
        }
Exemple #4
0
        public void GPSCoordinatesDMSToDecimalDegrees()
        {
            GPSCoords dmsTest = new GPSCoords("S37 47 16", "E175 18 37", "argis");

            Assert.AreEqual(-37.788047d, Convert.ToDouble(dmsTest.DecimalDegreesLatitude), PRECISION);

            Assert.AreEqual(175.310512d, Convert.ToDouble(dmsTest.DecimalDegreesLongitude), PRECISION);
        }
Exemple #5
0
        public void GPSCoordinatesDecimalDegreesToDMS()
        {
            GPSCoords degreeTest = new GPSCoords(-37.788047M, 175.310512M, "argis");

            Assert.AreEqual("S37 47 16", degreeTest.DMSLatitude);

            Assert.AreEqual("E175 18 37", degreeTest.DMSLongitude);
        }
Exemple #6
0
        public void GetGPSCoordinatesDMS()
        {
            GPSCoords dmsTest = new GPSCoords("S37 47 16", "E175 18 37", "argis");

            Assert.AreEqual("S37 47 15", dmsTest.DMSLatitude); //Pression difference

            Assert.AreEqual("E175 18 37", dmsTest.DMSLongitude);
        }
Exemple #7
0
        /// <summary>
        /// Creates a new Site.
        /// </summary>
        /// <param name="iD">The unique ID field of the Site</param>
        /// <param name="name">The name of this site</param>
        /// <param name="owner">The name of the owner of the Site</param>
        /// <param name="primaryContact">The details of the primary contact</param>
        /// <param name="secondaryContact">The details of the secondary contact</param>
        /// <param name="gpsLocation">The GPS coordinates of the Site</param>
        public Site(int iD, string name, string owner, Contact primaryContact, Contact secondaryContact, GPSCoords gpsLocation)
        {
            if (iD < 0)
                throw new ArgumentException("ID number must a non-negative integer");
            if (String.IsNullOrEmpty(name))
                throw new ArgumentException("Site must not be empty");
            /*if(String.IsNullOrEmpty(owner))
                throw new ArgumentException("Owner must not be empty");
            if(primaryContact == null)
                throw new ArgumentException("Primary contact must not be null");
            if(gpsLocation == null)
                throw new ArgumentException("GPS Location must be supplied");*/

            _iD = iD;
            _name = name;
            _owner = owner;
            _primaryContact = primaryContact;
            _secondaryContact = secondaryContact;
            _gpsLocation = gpsLocation;
            Events = new List<Event>();
        }
Exemple #8
0
        public void SetUp()
        {
            _pc = new Contact("Kerry", "Arts", "*****@*****.**", "Waikato Uni", "0800 stuff");
            _sc = new Contact("Steven", "McTainsh", "*****@*****.**", "CMS", "0800 WAIKATO");
            _gps = new GPSCoords(37.5135426m, 6.21684m,"jayqon");
            _testSite = new Site(1, "Lake Rotorua", "Chris McBride", _pc, _sc, _gps);

            A = new Site(6, "A Site", "David Hamilton",
                             new Contact("David", "Hamilton", "*****@*****.**", "UoW", "1234567"),
                             new Contact("Stan", "Smith", "*****@*****.**", "CIA", "1212127"),
                             new GPSCoords(49, -2,"jayqon"));
            B = new Site(6, "A Site", "David Hamilton",
                             new Contact("David", "Hamilton", "*****@*****.**", "UoW", "1234567"),
                             new Contact("Stan", "Smith", "*****@*****.**", "CIA", "1212127"),
                             new GPSCoords(49, -2,"jayqon"));
        }
Exemple #9
0
 public void GpsCoordinateGetSetTest()
 {
     Assert.AreEqual(_gps, _testSite.GpsLocation);
     _gps = new GPSCoords("N52 31 4", "E57 12 45","jayqon");
     _testSite.GpsLocation = _gps;
     Assert.AreEqual(_gps, _testSite.GpsLocation);
 }