예제 #1
0
파일: List.cs 프로젝트: PaulCampbell/ATP
 public void AddPlace(Place place)
 {
     if (!Places.Any(p => p == "places/" + place.Id))
     {
         Places.Add("places/" + place.Id);
         NumberOfPlaces++;
     }
 }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
        // 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;
        }
예제 #6
0
 public void place_inherits_from_entity()
 {
     var l = new Place();
     Assert.IsTrue(l is Entity);
 }