コード例 #1
0
        public void UnitTest9()
        {
            var context        = new CalDavContext(new DbContextOptions <CalDavContext>());
            var prinRepository = new PrincipalRepository(context);

            var user = prinRepository.CreateWorkerInSystem("*****@*****.**", "worker", "UnitTest9 worker", _faculty,
                                                           "Weboo");

            context.SaveChanges();
            Assert.True(context.Workers.Count() > 0);

            var worker = context.Workers.FirstOrDefault(x => x.Email == "*****@*****.**");

            Assert.NotNull(worker);
            Assert.NotNull(context.Principals.FirstOrDefault(x => x.PrincipalId == worker.PrincipalId.Value));
            Assert.NotNull(context.CalendarCollections.FirstOrDefault(x => x.PrincipalId == worker.PrincipalId.Value));
        }