public void ApiGetBadges() { var acc = Mock.Of <IBadgeService>(a => a.GetBadges() == _manyBadges); var uow = Mock.Of <IUnitOfWork>(u => u.BadgeService == acc); BadgesController controller = new BadgesController(uow); var badges = controller.GetBadges(); Assert.IsTrue(badges.EqualValues(_manyBadges)); }
public async Task TestGetBadgesAsync() { var mockRepo = new Mock <IRepositoryWrapper>(); mockRepo.Setup(repo => repo.Badges.GetAll()) .ReturnsAsync(_fakeData.GetFakeBadges()); var controller = new BadgesController(mockRepo.Object); var badges = await controller.GetBadges(); Assert.Equal(2, badges.Count()); }