Exemplo n.º 1
0
        public async System.Threading.Tasks.Task TestDeletingClassSchedule()
        {
            DataChanges changes = new DataChanges();

            changes.Add(new DataItemSchedule()
            {
                Identifier      = Guid.NewGuid(),
                UpperIdentifier = base.CurrentClassId,
                StartTime       = new DateTime(2015, 1, 1, 8, 00, 00, DateTimeKind.Utc),
                EndTime         = new DateTime(2015, 1, 1, 8, 50, 00, DateTimeKind.Utc),
                Room            = "Modern Languages 201",
                ScheduleWeek    = Schedule.Week.BothWeeks,
                ScheduleType    = Schedule.Type.Normal,
                DayOfWeek       = DayOfWeek.Monday
            });

            await DataStore.ProcessLocalChanges(changes);

            var viewModel = await ViewModelClass.LoadAsync(base.LocalAccountId, base.CurrentClassId, new DateTime(2015, 1, 1, 0, 0, 0, DateTimeKind.Utc));

            Assert.AreEqual(1, viewModel.Class.Schedules.Count);

            var schedule = viewModel.Class.Schedules[0];


            changes = new DataChanges();

            changes.DeleteItem(schedule.Identifier);

            await DataStore.ProcessLocalChanges(changes);

            viewModel = await ViewModelClass.LoadAsync(base.LocalAccountId, base.CurrentClassId, new DateTime(2015, 1, 1, 0, 0, 0, DateTimeKind.Utc));

            Assert.AreEqual(0, viewModel.Class.Schedules.Count);
        }
Exemplo n.º 2
0
        public async Task TestAddingClass_Defaults()
        {
            DataItemClass c = new DataItemClass()
            {
                Identifier      = Guid.NewGuid(),
                UpperIdentifier = base.CurrentSemesterId,
                Credits         = 3,
                Name            = "Math",
                Details         = "",
                RawColor        = ColorTools.GetArray(Colors.Red, 3)
            };

            DataChanges changes = new DataChanges();

            changes.Add(c);

            await base.DataStore.ProcessLocalChanges(changes);

            var viewModel = await ViewModelClass.LoadAsync(base.LocalAccountId, c.Identifier, DateTime.Today);

            var viewClass = viewModel.Class;

            Assert.AreEqual("Math", viewClass.Name);
            Assert.AreEqual(3, viewClass.Credits);
            Assert.AreEqual("", viewClass.Details);
            Assert.AreEqual(Colors.Red, viewClass.Color);
        }