public void GetFoodOfTheMonth_WithExistingTaskInputs_ReturnsFoodGuid()
        {
            // Arrange
            TaskInputService service = new TaskInputService(config, context);
            var food = context.Food.Add(new Food
            {
                Id           = Guid.NewGuid(),
                CalorieCount = 70,
                Name         = "TestFood",
                Unit         = "Piece"
            }).Entity;

            context.SaveChanges();
            context.TaskInput.Add(new TaskInput
            {
                Id               = Guid.NewGuid(),
                PatientId        = patient.PatientCode,
                OrganizationCode = patient.OrganisationCode,
                Weight           = 60,
                Foods            = food.Id.ToString(),
                FoodQuantities   = "3",
                MealTimes        = "1",
                Exercises        = "",
                ExerciseReps     = "",
                DateAssigned     = DateTimeOffset.UtcNow.AddDays(-10)
            });
            context.SaveChanges();

            // Act
            var result = service.GetFoodOfTheMonth(patient.Username);

            // Assert
            Assert.That(result, Is.Not.Null);
            Assert.That(result, Is.EqualTo(food.Id));
        }
        public void GetFoodOfTheMonth_WithNoTaskInputs_ReturnsEmptyGuid()
        {
            // Arrange
            TaskInputService service = new TaskInputService(config, context);

            // Act
            var result = service.GetFoodOfTheMonth(patient.Username);

            // Assert
            Assert.That(result, Is.Not.Null);
            Assert.That(result, Is.EqualTo(Guid.Empty));
        }
Esempio n. 3
0
        public Guid GetFoodOfTheMonth()
        {
            var foodOfTheMonth = taskInputService.GetFoodOfTheMonth(User.Identity.Name);

            return(foodOfTheMonth);
        }