public async void ServiceShouldRemoveBadgeFromUser() { //arrange var badgeRepositoryMock = new Mock <IBadgeRepository>(); var mockUnitOfWork = new Mock <IUnitOfWork>(); var userManagerMock = MockUserManager <User>(); userManagerMock.Setup(um => um.Users).Returns(_users.AsQueryable); BadgeService badgeService = new BadgeService(mockUnitOfWork.Object, userManagerMock.Object); var badgeToRemove = badgeService.AddBadgeToUser(_userId, testBadge); //act var isRemoved = badgeService.RemoveBadgeFromUser(_userId, badgeToRemove); //assert isRemoved.Should().BeTrue(); }
public async void ServiceShouldAddBadgeToUser() { Guid guid = new Guid(); var badgeRepositoryMock = new Mock <IBadgeRepository>(); var mockUnitOfWork = new Mock <IUnitOfWork>(); var userManagerMock = MockUserManager <User>(); userManagerMock.Setup(um => um.Users).Returns(_users.AsQueryable); BadgeService badgeService = new BadgeService(mockUnitOfWork.Object, userManagerMock.Object); //Act var badgeAdded = badgeService.AddBadgeToUser(_userId, testBadge); //Assert badgeAdded.Should().Equals(testBadge); }