Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        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);
        }