Exemple #1
0
        public void SaveTask()
        {
            var repository = new GoalRepository(GetTestFileFolder());
            var task       = new Task();

            task.Id      = "A9D3DD63-A0F3-4E02-A14A-8DA64CF923C3";
            task.Title   = "New Task";
            task.Initial = 5;
            task.Target  = 200;
            task.Activity.Add(new TaskActivity()
            {
                Date = DateTime.Parse("2020-03-13"), Value = 88
            });

            repository.SaveTask(task);

            var savedTask = repository.GetTask("A9D3DD63-A0F3-4E02-A14A-8DA64CF923C3");

            Assert.Equal("A9D3DD63-A0F3-4E02-A14A-8DA64CF923C3", savedTask.Id);
            Assert.Equal("New Task", savedTask.Title);
            Assert.Equal(5, savedTask.Initial);
            Assert.Equal(200, savedTask.Target);
            Assert.Equal(1, savedTask.Activity.Count);
            Assert.Equal(DateTime.Parse("2020-03-13"), savedTask.Activity[0].Date);
            Assert.Equal(88, savedTask.Activity[0].Value);
        }