示例#1
0
        public async void UpdateOne()
        {
            int         taskid     = 1;
            ServiceTask UpdateData = new ServiceTask
            {
                TargetId    = 1,
                Description = "Edited",
                Closed      = true
            };
            IServiceTaskService serviceTaskService = new ServiceTaskService();

            await serviceTaskService.UpdateAsync(UpdateData, taskid);

            var sts = (await serviceTaskService.GetAllAsync()).ToList();

            foreach (var st in sts)
            {
                if (st.TaskId == taskid)
                {
                    Assert.Equal(1, st.TargetId);
                    Assert.Equal("Edited", st.Description);
                    Assert.True(st.Closed);
                }
            }
        }
示例#2
0
        public async void CreateOne()
        {
            ServiceTask newTask = new ServiceTask
            {
                Closed      = false,
                TargetId    = 13,
                Description = "Find this",
                Criticality = TaskCriticality.Critical
            };
            IServiceTaskService serviceTaskService = new ServiceTaskService();

            await serviceTaskService.CreateAsync(newTask);

            var sts = (await serviceTaskService.GetAsync(13)).ToList();

            Assert.NotEmpty(sts);
            foreach (var st in sts)
            {
                if (st.Description == "Find this")
                {
                    Assert.False(st.Closed);
                    Assert.Equal(TaskCriticality.Critical, st.Criticality);
                    return;
                }
            }
            Assert.Equal(0, 1);
        }
示例#3
0
        public async void NonExistingTasksForTarget()
        {
            IServiceTaskService serviceTaskService = new ServiceTaskService();
            int fdId = 1;

            var sts = (await serviceTaskService.GetAsync(fdId)).ToList();

            Assert.Empty(sts);
        }
示例#4
0
        public async void ExistingTasksForTarget()
        {
            IServiceTaskService serviceTaskService = new ServiceTaskService();
            int fdId = 11;

            var sts = (await serviceTaskService.GetAsync(fdId)).ToList();

            Assert.NotNull(sts);
            Assert.Equal(2, sts.Count);
        }
示例#5
0
        public async void AllTasks()
        {
            IServiceTaskService serviceTaskService = new ServiceTaskService();

            var sts = (await serviceTaskService.GetAllAsync()).ToList();

            Assert.NotNull(sts);
            Assert.NotEmpty(sts);
            Assert.True(10 <= sts.Count());
        }
示例#6
0
        public async void DeleteOne()
        {
            int taskid = 1;
            IServiceTaskService serviceTaskService = new ServiceTaskService();

            await serviceTaskService.DeleteAsync(taskid);

            var sts = (await serviceTaskService.GetAllAsync()).ToList();

            foreach (var st in sts)
            {
                Assert.NotEqual(1, st.TaskId);
            }
        }
示例#7
0
        public async void SearchByCriticality()
        {
            Search search = new Search
            {
                MinCriticality = 1
            };
            IServiceTaskService serviceTaskService = new ServiceTaskService();

            var sts = (await serviceTaskService.SearchAsync(search)).ToList();

            foreach (var st in sts)
            {
                Assert.Equal(1, (int)st.Criticality);
            }
        }