Exemple #1
0
        public void SlotStorageOperations()
        {
            // Arrange
            TimeModel timeService = TimeModel.getService();
            DateTime  start       = DateTime.Today;
            DateTime  end         = DateTime.Now;
            string    desc        = "A daily dummy job";
            string    project     = "Test";
            Slot      createdSlot = new Slot(start, end, desc, project);

            // Act
            timeService.InsertSlot(createdSlot);
            long id        = timeService.GetSlotIdByData(start, end, desc, project);
            Slot foundSlot = timeService.GetSlotByID(id);

            // Assert
            Assert.AreEqual(createdSlot, foundSlot);

            // Act
            createdSlot.Description = "An updated activity description";
            timeService.UpdateSlot(createdSlot);
            foundSlot = timeService.GetSlotByID(id);

            // Assert
            Assert.AreEqual(foundSlot.Description, createdSlot.Description);

            // Act
            timeService.DeleteSlot(id);
            foundSlot = timeService.GetSlotByID(id);
            long noId = timeService.GetSlotIdByData(createdSlot.Start, createdSlot.End, createdSlot.Description, createdSlot.Project);

            // Assert
            Assert.IsNull(foundSlot);
            Assert.AreEqual(noId, TimeModel.NON_VALUE);
        }