public void Setup()
            {
                var loc = new HashLocation {
                    Latitude = lat, Longitude = lon
                };

                Neighbours = loc.Neighbours;
            }
            public void CheckCenterLeftNeighbourLongitudeInMelbourne()
            {
                var loc = new HashLocation {
                    Latitude = -37, Longitude = 145
                };
                var neighbours = loc.Neighbours;

                Assert.AreEqual(neighbours[3].Longitude, 144);
            }
            public void CheckNeighbour4Lat()
            {
                var loc = new HashLocation {
                    Latitude = lat, Longitude = lon
                };
                var neighbours = loc.Neighbours;

                Assert.AreEqual(neighbours[4].Latitude, 0.3);
            }
            public void CheckNeighbour7Lon()
            {
                var loc = new HashLocation {
                    Latitude = lat, Longitude = lon
                };
                var neighbours = loc.Neighbours;

                Assert.AreEqual(neighbours[7].Longitude, -179.3);
            }
            public void CheckTopRightNeighbourLongitudeInMelbourne()
            {
                var loc = new HashLocation {
                    Latitude = -37, Longitude = 145
                };
                var neighbours = loc.Neighbours;

                Assert.AreEqual(neighbours[2].Longitude, 146);
            }
            public void CheckTopCenterNeighbourLatitudeInMelbourne()
            {
                var loc = new HashLocation {
                    Latitude = -37, Longitude = 145
                };
                var neighbours = loc.Neighbours;

                Assert.AreEqual(neighbours[1].Latitude, -38);
            }
            public void CheckNeighbour7Lat()
            {
                var loc = new HashLocation {
                    Latitude = 3, Longitude = 3
                };
                var neighbours = loc.Neighbours;

                Assert.AreEqual(neighbours[7].Latitude, 2);
            }
            public void CheckBottomRightNeighbourLatitudeInMelbourne()
            {
                var loc = new HashLocation {
                    Latitude = -37, Longitude = 145
                };
                var neighbours = loc.Neighbours;

                Assert.AreEqual(neighbours[7].Latitude, -36);
            }
Example #9
0
        public static async Task <Response <HashLocation> > GetHashData(DateTime date, Location currentLocation)
        {
            var date30W = DowJonesDates.Get30WCompliantDate(date, currentLocation);
            var djDate  = DowJonesDates.GetApplicableDJDate(date30W);
            var djia    = await Webclient.GetDjia(djDate);

            if (!djia.Success)
            {
                return(new Response <HashLocation>(null, false, djia.Message));
            }
            var offset = CalculateOffset(date, djia.Data);
            var loc    = CalculateHashLocation(currentLocation, offset);

            var hash = new HashLocation(loc.Latitude, loc.Longitude, date, false, false);

            return(new Response <HashLocation>(hash, true, "Hashes calculated successfully"));
        }