public void AddPlace(Place place) { if (!Places.Any(p => p == "places/" + place.Id)) { Places.Add("places/" + place.Id); NumberOfPlaces++; } }
public void can_add_new_place() { var p = new Place {Id = 1}; var l = new List(); l.AddPlace(p); Assert.AreEqual(1, l.Places.Count); }
public void cannot_add_duplicate_places() { var p = new Place { Id = 1 }; var l = new List(); l.AddPlace(p); l.AddPlace(p); Assert.AreEqual(1, l.Places.Count); }
public void add_new_place_increments_numberOfPlaces() { var p = new Place { Id = 1 }; var p2 = new Place { Id = 2 }; var sut = GetList(); sut.AddPlace(p); sut.AddPlace(p2); Assert.AreEqual(2, sut.NumberOfPlaces); }
// GET /api/values public User Get() { var user = DocumentSession.Load<User>(2); var list = new List(); list.User = "******"; var p = new Place { Description = "Kinda trendy place - multiple rooms, decent beer from Leeds brewary and guests", Latitude = 52.002324f, Longitude = -0.5734f, Name = "The Adelphi" }; DocumentSession.Store(p); DocumentSession.SaveChanges(); list.AddPlace(p); DocumentSession.Store(list); DocumentSession.SaveChanges(); return user; }
public void place_inherits_from_entity() { var l = new Place(); Assert.IsTrue(l is Entity); }