Exemplo n.º 1
0
        public async Task calculating_plan_for_user_without_weightpoints_should_return_exception()
        {
            var userRepositoryMock = new Mock <IUserRepository>();
            var planRepositoryMock = new Mock <IPlanRepository>();
            var mapperMock         = new Mock <IMapper>();

            userRepositoryMock.Setup(x => x.GetAsync(testUserGuid)).ReturnsAsync(() => robustTestUser);

            var planService = new PlanService(userRepositoryMock.Object, planRepositoryMock.Object, mapperMock.Object);

            Assert.ThrowsAsync <Exception>
                (() => planService.CalculatePlan(testUserGuid, 3));
        }
Exemplo n.º 2
0
        public async Task calculating_plan_for_nonexistent_user_should_return_exception()
        {
            var userRepositoryMock = new Mock <IUserRepository>();
            var planRepositoryMock = new Mock <IPlanRepository>();
            var mapperMock         = new Mock <IMapper>();

            userRepositoryMock.Setup(x => x.GetAsync(nonexistentGuid)).ReturnsAsync(() => null);

            var planService = new PlanService(userRepositoryMock.Object, planRepositoryMock.Object, mapperMock.Object);

            Assert.ThrowsAsync <Exception>
                (() => planService.CalculatePlan(nonexistentGuid, 3));
        }