예제 #1
0
 public void LocationAddShouldAddLocation(Location loc)
 {
     var newLoc = controller.LocationAdd(new Location { placeId = "c" });
     Assert.NotNull(newLoc);
     Assert.IsTrue(newLoc.placeId == "c");
 }
예제 #2
0
        public TestDatabaseContext()
        {
            var l1 = new Location
            {
                LocationId = 1,
                Address = "a street",
                City = "New York",
                State = "NY",
                Zip = "10000",
                Name = "l1",
                XCoordinate = 25.2,
                YCoordinate = 30.1,
                placeId = "a"
            };

            var l2 = new Location
            {
                LocationId = 2,
                Address = "b street",
                City = "New York",
                State = "NY",
                Zip = "10001",
                Name = "l2",
                XCoordinate = 22.2,
                YCoordinate = 32.1,
                placeId = "b"
            };

            locations = new List<Location>();
            locations.Add(l1);
            locations.Add(l2);

            var c1 = new Category
            {
                CategoryId = 1,
                Name = "General"
            };

            var c2 = new Category
            {
                CategoryId = 2,
                Name = "Food"
            };
            var c3 = new Category
            {
                CategoryId = 3,
                Name = "Parking"
            };

            categories = new List<Category>();
            categories.Add(c1);
            categories.Add(c2);
            categories.Add(c3);

            var r1 = new Review
            {
                ReviewId = 1,
                Author = "A",
                Category = c1,
                Location = l1,
                ReviewText = "Pretty good.",
                Stars = 8,
                IsActive = true
            };
            var r2 = new Review
            {
                ReviewId = 2,
                Author = "B",
                Category = c2,
                Location = l2,
                ReviewText = "Plenty of parking spaces",
                Stars = 10,
                IsActive = true
            };
            var r3 = new Review
            {
                ReviewId = 3,
                Author = "B",
                Category = c2,
                Location = l2,
                ReviewText = "Plenty of parking spaces",
                Stars = 10,
                IsActive = true
            };
            var r4 = new Review
            {
                ReviewId = 4,
                Author = "B",
                Category = c1,
                Location = l2,
                ReviewText = "Plenty of parking spaces",
                Stars = 10
            };

            reviews = new List<Review>();
            reviews.Add(r1);
            reviews.Add(r2);
            reviews.Add(r3);
            reviews.Add(r4);
        }
예제 #3
0
 public Location LocationAdd(Location loc)
 {
     return db.LocationAdd(loc);
 }
예제 #4
0
 public Location LocationAdd(Location loc)
 {
     if (loc == null)
         return new Location();
     return Locations.Add(loc);
 }