示例#1
0
        public async Task DeleteAppointment(string key)
        {
            var testCase = ScheduleCases.DeleteAppointment(key);

            using (var db = Db.dbConn())
            {
                db.AddRange(testCase.Given);
                await db.SaveChangesAsync();
            }

            using (var sut = SutFactory())
            {
                var r = await sut.DeleteAppointment(
                    testCase.Arguments.Item1,
                    testCase.Arguments.Item2);

                Assert.AreEqual(testCase.Expect.ToString(), r.ToString());
            }

            using (var db = Db.dbConn())
            {
                var onRecord = await(from a in db.Appointments
                                     where
                                     a.Schedule.PrincipalId == testCase.Arguments.Item1.Id &&
                                     a.ScheduleName == testCase.Arguments.Item1.Schedule &&
                                     a.Start == testCase.Arguments.Item2
                                     select a).AnyAsync();

                Assert.IsFalse(onRecord);
            }
        }
示例#2
0
        public async Task GetSchedule(string key)
        {
            var testCase = ScheduleCases.GetSchedule(key);

            using (var db = Db.dbConn())
            {
                db.AddRange(testCase.Given);
                await db.SaveChangesAsync();
            }

            using (var sut = SutFactory())
            {
                var r = await sut.Get(testCase.Arguments);

                Assert.IsTrue(testCase.Expect.SequenceEqual(r));
            }
        }
示例#3
0
        public async Task PutSchedule(string key)
        {
            var testCase = ScheduleCases.PutAppointment(key);

            using (var db = Db.dbConn())
            {
                db.AddRange(testCase.Given);
                await db.SaveChangesAsync();
            }

            using (var sut = SutFactory())
            {
                var r = await sut.PostAppointment(
                    testCase.Arguments.Item1,
                    testCase.Arguments.Item2);

                Assert.AreEqual(testCase.Expect, r);
            }
        }