Esempio n. 1
0
        public async Task DeleteUserShouldWorkCorrectly()
        {
            var appUsers = new List <ApplicationUser>();

            var mockAppUser = new Mock <IDeletableEntityRepository <ApplicationUser> >();

            mockAppUser.Setup(x => x.All()).Returns(appUsers.AsQueryable());
            mockAppUser.Setup(x => x.AddAsync(It.IsAny <ApplicationUser>())).Callback((ApplicationUser appU) => appUsers.Add(appU));

            var service = new AdminsService(null, null, null, null, mockAppUser.Object);

            var user = new ApplicationUser
            {
                Id = "123",
            };

            appUsers.Add(user);
            await service.DeleteUser("123");

            Assert.Equal(true, user.IsDeleted);
        }