예제 #1
0
        public async Task DeleteActivityAsync_CheckErrorOccured(int id)
        {
            using var context = PrepareData.GetDbContext(); var service = new ActivitiesService(context);
            var value = await service.DeleteActivityAsync(id, null);

            Assert.True(value.IsLeft);
        }
예제 #2
0
        public async Task DeleteActivityAsync_CorrectUpdateOnContext(
            int slot, string classgroup, string teacher, string room)
        {
            using var context = PrepareData.GetDbContext(); var activityToDelete = GetActivities(context).FirstOrDefault(
                a => a.Slot.Index == slot &&
                a.Room.Name == room &&
                a.Teacher.Name == teacher &&
                a.ClassGroup.Name == classgroup
                );
            var service = new ActivitiesService(context);
            var value   = await service.DeleteActivityAsync(activityToDelete.Id, activityToDelete.Timestamp);

            var activity = context.Activities.FirstOrDefault(a => a.Id == activityToDelete.Id);

            Assert.Null(activity);
            Assert.True(value.IsRight);
        }