public void GetLocationByIdShouldGetCorrectLocation()
 {
     using (var ctx = new StoreContext(options))
     {
         StoreRepoDB repo     = new StoreRepoDB(ctx);
         var         location = repo.GetLocationById(3);
         Assert.Null(location);
         for (int i = 0; i < 5; i++)
         {
             Location testLocation = new Location();
             testLocation.LocationName    = $"Test{i}";
             testLocation.LocationAddress = "asdf";
             ctx.Locations.Add(testLocation);
         }
         ctx.SaveChanges();
     }
     using (var assertCtx = new StoreContext(options))
     {
         StoreRepoDB repo     = new StoreRepoDB(assertCtx);
         var         location = repo.GetLocationById(3);
         Assert.NotNull(location);
         Assert.Equal(3, location.LocationId);
     }
 }
Esempio n. 2
0
 public Location GetLocationById(int id)
 {
     return(repo.GetLocationById(id));
 }