Ejemplo n.º 1
0
        public async Task ChangePermission_WithUser_ShouldChangeUserPermission()
        {
            // Arrange
            FitStoreDbContext database = this.Database;

            DatabaseHelper.SeedData(database);

            User user = database.Users.Find(firstUserId);

            IModeratorUserService moderatorUserService = new ModeratorUserService(database);

            // Act
            await moderatorUserService.ChangePermission(user);

            // Assert
            user.IsRestricted.Should().Be(true);
        }
Ejemplo n.º 2
0
        public async Task GetAllListingAsync_WithSearchTokenAndWithPage_ShouldReturnPagedUsers()
        {
            // Arrange
            FitStoreDbContext database = this.Database;

            DatabaseHelper.SeedData(database);

            IModeratorUserService moderatorUserService = new ModeratorUserService(database);

            // Act
            IEnumerable <ModeratorUserBasicServiceModel> result = await moderatorUserService.GetAllListingAsync("user", page);

            // Assert
            result.Count().Should().Be(5);
            result.First().Id.Should().Be(firstUserId);
            result.First().Username.Should().Be(firstUsername);
            result.Last().Id.Should().Be(lastUserId);
            result.Last().Username.Should().Be(lastUsername);
        }
Ejemplo n.º 3
0
        public async Task TotalCountAsync_WithoutSearchToken_ShouldReturnUsersCount()
        {
            // Arrange
            FitStoreDbContext database = this.Database;

            DatabaseHelper.SeedData(database);

            database.Users.Add(new User {
                Id = "Id", UserName = "******"
            });
            database.SaveChanges();

            IModeratorUserService moderatorUserService = new ModeratorUserService(database);

            // Act
            int result = await moderatorUserService.TotalCountAsync(null);

            // Assert
            result.Should().Be(11);
        }