Esempio n. 1
0
        public async Task Test_UpsertGoalsController_Success()
        {
            _goalServices.Setup(g => g.UpsertGoalsService(It.IsAny <List <GoalModel> >()))
            .Returns(Task.CompletedTask);

            var controller = new GoalController(_goalServices.Object);
            var response   = await controller.UpsertGoals(new UpsertGoalsRequest()
            {
                UpsertGoals = new List <UpsertGoal>()
                {
                    new UpsertGoal()
                    {
                        Id           = 5,
                        UserId       = 5,
                        GoalAmount   = 50,
                        TargetAmount = 500,
                        GoalName     = "Goal Name",
                        GoalSummary  = "Goal Summary",
                        StartDate    = DateTime.Now,
                        EndDate      = DateTime.Now
                    }
                }
            });

            Assert.NotNull(response);
            Assert.AreEqual(200, ((OkResult)response).StatusCode);
        }
Esempio n. 2
0
        public async Task Test_UpsertGoalsController_BadArgument()
        {
            _goalServices.Setup(g => g.UpsertGoalsService(It.IsAny <List <GoalModel> >()))
            .Returns(Task.CompletedTask);

            var controller = new GoalController(_goalServices.Object);
            var response   = await controller.UpsertGoals(null);

            Assert.NotNull(response);
            Assert.AreEqual(400, ((ObjectResult)response).StatusCode);
        }