Exemplo n.º 1
0
        public void CheckExistingEvent_Successfully()
        {
            var newEvent = new Event { Id = "123" };
            _db.Insert(_event);
            _db.Insert(newEvent);

            Assert.IsTrue(_db.EventExist(_event));
            Assert.IsTrue(_db.EventExist(newEvent));

            Assert.IsFalse(_db.EventExist(new Event { Id = "NonExisting" }));
        }
Exemplo n.º 2
0
        public bool EventExist(Event ev)
        {
            if (this._lst != null)
            {
                foreach (var e in _lst)
                {
                    if (ev.Id == e.Id)
                    {
                        return true;
                    }
                }
            }

            return false;
        }
Exemplo n.º 3
0
        public bool Delete(Event ev)
        {
            if (this._lst != null)
            {
                foreach (var e in this._lst)
                {
                    if (ev.Id == e.Id)
                    {
                        // Delete event
                        var ss = this._lst.Remove(e);
                        return SaveAll();
                    }
                }
            }

            return false;
        }
Exemplo n.º 4
0
        public void GetEvents(EventSearchParams searchParams, Action<Api.EventSet> onGetCompleted = null, Action onBegin = null, Action<Exception> onError = null, Action onFinally = null)
        {
            if (onBegin != null)
                onBegin();

            if (onGetCompleted != null)
            {
                const int total = 20;

                Api.EventSet eventSet = new Api.EventSet();
                var events = new Event[total];
                for (int i = 0; i < total; i++)
                {
                    events[i] = new Event
                    {
                        Id = string.Format("{0} - {1}", "event", i),
                        CityName = "City " + i,
                        Country = "Country-" + i,
                        Description = "Description-" + i,
                        Latitude = "3430.0",
                        Longitude = "89.023",
                        PostalCode = "783" + i,
                        Price = i.ToString(),
                        RecurString = "Recuring String " + i,
                        StartTime = DateTime.Now.ToLongDateString(),
                        StopTime = DateTime.Now.AddDays(2).ToLongDateString(),
                        Title = "Title - " + i,
                        Url = "http://example.com",
                        VenueAddress = "Venue Address " + i,
                        VenueName = "Venue name " + i
                    };
                }
                eventSet.Events = events;
                onGetCompleted(eventSet);
            }

            if (onFinally != null)
                onFinally();
        }
        public static bool SaveEvent(Event temp)
        {
            IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication();

            try
            {
                // create a new file (overwrite existing)
                using (IsolatedStorageFileStream file = store.CreateFile(_temp))
                {
                    _tempSerializer.Serialize(file, temp);
                }
                return true;
            }
            catch
            {
                return false;
            }
        }
Exemplo n.º 6
0
 public void SetUp()
 {
     _db = new UserEventsTestDb();
     _event = new Event
     {
         Id = "1234567899",
         CityName = "City 1",
         Country = "Country 1",
         Description = "Event 1 description",
         Latitude = "67.87972",
         Longitude = "52.9900",
         PostalCode = "10001",
         Price = "5",
         Title = "Event 1",
         VenueName = "Event 1 venue",
         VenueAddress = "Event 1 venue address"
     };
 }
Exemplo n.º 7
0
        public bool Insert(Event ev)
        {
            if (!EventExist(ev))
            {
                this._lst.Add(ev);
                return SaveAll();
            }

            return false;
        }