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); } }
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)); } }
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); } }