Exemple #1
0
        public void UpdateLocationTest()
        {
            try
            {
                DbLocation dbLocation = new DbLocation();
                Location   location   = new Location
                {
                    User = new User {
                        UserId = 1
                    },
                    Latitude            = 1,
                    Longitude           = 1,
                    LocationDescription = "Test description",
                    LocationName        = "UpdateTest1"
                };
                Location newLocation = location;
                newLocation.LocationDescription = "Test description";
                newLocation.LocationName        = "UpdateTest2";

                int id = dbLocation.Create(location);
                location.LocationId    = id;
                newLocation.LocationId = id;
                dbLocation.UserUpdateLocation(newLocation);
                string foundLocationName = dbLocation.FindById(id).LocationName;
                Assert.IsTrue(foundLocationName.Equals("UpdateTest2"));
                dbLocation.Delete(id);
            }
            catch (FaultException <System.Exception> )
            {
                Assert.Fail();
            }
        }
Exemple #2
0
 public void UpdateHitsTest()
 {
     try
     {
         DbLocation dbLocation = new DbLocation();
         Location   location   = new Location
         {
             User = new User {
                 UserId = 1
             },
             Latitude            = 1,
             Longitude           = 1,
             LocationDescription = "Test description",
             LocationName        = "UpdateHitsTest",
             Hits = 0
         };
         int id = dbLocation.Create(location);
         location.LocationId = id;
         dbLocation.UpdateHits(location);
         Location newLocation = dbLocation.FindById(id);
         Assert.IsTrue(location.Hits < newLocation.Hits);
         dbLocation.Delete(location.LocationId);
     }
     catch (FaultException <System.Exception> )
     {
         Assert.Fail();
     }
 }
Exemple #3
0
 public void ReadLocationTest()
 {
     try
     {
         DbLocation dbLocation = new DbLocation();
         Location   location   = dbLocation.FindById(10);
         Assert.IsNotNull(location);
     }
     catch (FaultException <System.Exception> )
     {
         Assert.Fail();
     }
 }
 /// <summary>
 /// gets a location by its id
 /// </summary>
 /// <param name="locationId"></param>
 /// <returns>Location</returns>
 public Location GetLocationById(int locationId)
 {
     return(_dbLocation.FindById(locationId));
 }