示例#1
0
        public void Test_Create_Invite_NotFound()
        {
            var userRepo = new UserRepository(database);
            var usr      = userRepo.CreateNew(new User {
                DateCreated = DateTime.Now, Email = "*****@*****.**", Name = "Jaytee"
            });
            var invRepo = new InviteRepository(database, userRepo);
            var project = invRepo.CreateNew(new Project {
                CreatedByUserId = usr.Id, DateCreated = DateTime.Now, Description = "A demo api", Name = "DEMO API"
            });
            var service = new InviteService(invRepo);

            Assert.ThrowsAsync <DocIT.Core.Services.Exceptions.InviteException>(async() => await service.CreateInvite(new Core.Data.Payloads.InvitePayload {
                Email = "*****@*****.**", ProjectId = Guid.NewGuid()
            }, Guid.NewGuid()));
        }
示例#2
0
        public void TestCreateInvite()
        {
            var userRepo = new UserRepository(database);
            var usr      = userRepo.CreateNew(new User {
                DateCreated = DateTime.Now, Email = "*****@*****.**", Name = "Jaytee"
            });
            var invRepo = new InviteRepository(database, userRepo);
            var project = invRepo.CreateNew(new Project {
                CreatedByUserId = usr.Id, DateCreated = DateTime.Now, Description = "A demo api", Name = "DEMO API"
            });
            var ivc = invRepo.CreateInvite(new Invite {
                Email = "*****@*****.**", InvitedAt = DateTime.Now
            }, project.Id, usr.Id);

            Assert.NotNull(ivc);
            Assert.NotEmpty(ivc.Invites);
        }
示例#3
0
        public void Test_Create_Invite()
        {
            var userRepo = new UserRepository(database);
            var usr      = userRepo.CreateNew(new User {
                DateCreated = DateTime.Now, Email = "*****@*****.**", Name = "Jaytee"
            });
            var invRepo = new InviteRepository(database, userRepo);
            var project = invRepo.CreateNew(new Project {
                CreatedByUserId = usr.Id, DateCreated = DateTime.Now, Description = "A demo api", Name = "DEMO API"
            });
            var service = new InviteService(invRepo);

            var res = service.CreateInvite(new Core.Data.Payloads.InvitePayload {
                Email = "*****@*****.**", ProjectId = project.Id
            }, Guid.NewGuid()).Result;

            Assert.NotNull(res);
        }