Ejemplo n.º 1
0
        public async Task UnassignedPersonnel_Some_ReturnAll()
        {
            string USER_ID_1 = Guid.NewGuid().ToString();
            string USER_ID_2 = Guid.NewGuid().ToString();
            string USER_ID_3 = Guid.NewGuid().ToString();

            await dbContext.Users.AddRangeAsync(
                new User("TestName1", "TestUserName1", "*****@*****.**", DateTime.Now) { QualificationId = QUALIFICATION_ID, Id = USER_ID_1 },
                new User("TestName2", "TestUserName2", "*****@*****.**", DateTime.Now) { QualificationId = QUALIFICATION_ID, Id = USER_ID_2 },
                new User("TestName3", "TestUserName3", "*****@*****.**", DateTime.Now) { QualificationId = QUALIFICATION_ID, Id = USER_ID_3 }
                );

            await dbContext.UserRoles.AddRangeAsync(
                new IdentityUserRole <string>() { UserId = USER_ID_1, RoleId = ROLE_ID },
                new IdentityUserRole <string>() { UserId = USER_ID_2, RoleId = ROLE_ID },
                new IdentityUserRole <string>() { UserId = USER_ID_3, RoleId = ROLE_ID }
                );

            await dbContext.SaveChangesAsync();

            var service = new AdminUserService(dbContext, userManager, roleManager, signInManager, new Mock <IServerNewsService>().Object);

            Dictionary <string, string> collection = await service.UnassignedPersonnelAsync();

            Assert.IsNotNull(collection);
            Assert.AreEqual(3, collection.Count);
        }
Ejemplo n.º 2
0
        public async Task UnassignedPersonnel_None_ReturnZero()
        {
            var service = new AdminUserService(dbContext, userManager, roleManager, signInManager, new Mock <IServerNewsService>().Object);

            Dictionary <string, string> collection = await service.UnassignedPersonnelAsync();

            Assert.IsNotNull(collection);
            Assert.AreEqual(0, collection.Count);
        }