Ejemplo n.º 1
0
        public void AddEvent_ValidEvent()
        {
            int expected = 1;

            setup();

            int actual = EventAccessor.AddEvent(eventToTest);

            EventAccessor.DeleteEventTestItem(eventToTest);

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 2
0
        public void UpdateEvent_ValidEvent()
        {
            int expected = 1;

            setup();
            EventAccessor.AddEvent(eventToTest);
            eventToTest = getEventObjectID(list);

            int actual = EventAccessor.UpdateEvent(eventToTest, eventToEdit);

            EventAccessor.DeleteEventTestItem(eventToEdit);

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 3
0
        public void GetEvent_Valid()
        {
            setup();

            string expected = eventToTest.EventItemName;

            EventAccessor.AddEvent(eventToTest);
            eventToEdit = getEventObjectID(list);

            Event actual = EventAccessor.GetEvent(eventToEdit.EventItemID.ToString());

            EventAccessor.DeleteEventTestItem(eventToTest);

            Assert.AreEqual(expected, actual.EventItemName);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Matt Lapka
 /// Created: 2015/01/31
 /// Add a single Event object
 /// </summary>
 /// <param name="newEvent">The Event object to be added to the database</param>
 /// <returns>An enumerated result depicting success or failure</returns>
 public EventResult AddNewEvent(Event newEvent)
 {
     try
     {
         if (EventAccessor.AddEvent(newEvent) == 1)
         {
             //refresh cache
             DataCache._currentEventList = EventAccessor.GetEventList();
             DataCache._EventListTime    = DateTime.Now;
             return(EventResult.Success);
         }
         return(EventResult.NotAdded);
     }
     catch (ApplicationException ex)
     {
         return(ex.Message == "Concurrency Violation" ? EventResult.ChangedByOtherUser : EventResult.DatabaseError);
     }
     catch (Exception)
     {
         return(EventResult.DatabaseError);
     }
 }