コード例 #1
0
ファイル: CrimeFetcherTests.cs プロジェクト: sta147/StealAPI
 public void CrimeFretcherCanFetchACrimeSomewhereNearALocation()
 {
     var crimeFretcher = new CrimeFetcher();
     var mosiLocation = new Location(-2.255562, 53.476788);
     var crimeList = crimeFretcher.FetchCrimesNearLocation(mosiLocation);
     Assert.AreNotEqual(0, crimeList.Count);
 }
コード例 #2
0
ファイル: CrimeController.cs プロジェクト: sta147/StealAPI
        public Crime GetARandomCrime()
        {
            CrimeFetcher crimeFetcher = new CrimeFetcher();
            var crimelist = crimeFetcher.FetchSomeCrimes();
            if (crimelist.Count > 0)
                return crimelist[0];

            return new Crime();
        }
コード例 #3
0
 public void TestMethod1()
 {
     var crimeFretcher = new CrimeFetcher();
     var mosiLocation = new Location(-2.255562, 53.476788);
     var crimeList = crimeFretcher.FetchCrimesNearLocation(mosiLocation);
     var northEastDirection = new NorthEastDirection(x => x.Location.Longitude > mosiLocation.Longitude
                 && x.Location.Latitude > mosiLocation.Latitude, crimeList, mosiLocation);
     var numberOfCrimesToTheNorthEast = northEastDirection.Count;
     Assert.AreNotEqual(numberOfCrimesToTheNorthEast, crimeList.Count);
 }
コード例 #4
0
ファイル: CrimeController.cs プロジェクト: sta147/StealAPI
        public Crime GetACrimeSomewhereNearLocation(double lat, double lng)
        {
            var location = new Location(lng, lat);
            var crimeFetcher = new CrimeFetcher();
            var crimelist = crimeFetcher.FetchCrimesNearLocation(location);
            if (crimelist.Count > 0)
                return crimelist[0];

            return new Crime();
        }
コード例 #5
0
ファイル: DirectionFinder.cs プロジェクト: sta147/StealAPI
 public Direction BestDirection()
 {
     var crimeFetcher = new CrimeFetcher();
     var crimelist = crimeFetcher.FetchCrimesNearLocation(location);
     if (crimelist.Count > 0)
     {
         NorthEastDirection northEastDirection = new NorthEastDirection(
             x => x.Location.Longitude > location.Longitude
                 && x.Location.Latitude > location.Latitude,
                 crimelist, location);
     }
     return new Direction()
     {
         Name = "North East",
         Bearing = 45,
         Count = 5
     };
 }
コード例 #6
0
ファイル: CrimeFetcherTests.cs プロジェクト: sta147/StealAPI
 public void CrimeFretcherCanFetchACrime()
 {
     var crimeFretcher = new CrimeFetcher();
     var crimeList = crimeFretcher.FetchSomeCrimes();
     Assert.AreNotEqual(0, crimeList.Count);
 }