示例#1
0
        public void AddToExistingTask()
        {
            TaskData taskData = new TaskData
            {
                Id      = Guid.NewGuid(),
                Data    = samsungJsonData,
                TasksId = Guid.Parse("09B15E45-8315-48D6-9EB2-21215295CECF")
            };

            TasksDataRepository.Add(taskData);
            Assert.Greater(TasksDataRepository.SaveChanges(), 0);
        }
示例#2
0
        public void Add()
        {
            User user = new User
            {
                FirstName   = "Test",
                LastName    = "User",
                Username    = "******",
                DateCreated = DateTime.UtcNow,
                Id          = Guid.Parse("270e042a-baf6-11e9-a2a3-2a2ae2dbcce4")
            };

            TaskData taskData = new TaskData
            {
                Id    = taskDataIdAdd,
                Data  = onePlusJsonData,
                Tasks = new Tasks
                {
                    TaskType = Enums.TaskType.GetDeviceInfo,
                    Status   = Enums.Status.Completed,
                    Device   = new Devices
                    {
                        Id           = Guid.NewGuid(),
                        Name         = "TasksDataDeviceAdd#1",
                        Model        = "TasksDataDeviceAdd#1",
                        Manufacturer = "TasksDataDeviceAdd",
                        User         = user
                    },
                }
            };

            TaskData taskDataUpdate = new TaskData
            {
                Id    = taskDataIdUpdate,
                Data  = samsungJsonData,
                Tasks = new Tasks
                {
                    TaskType = Enums.TaskType.GetDeviceInfo,
                    Status   = Enums.Status.Completed,
                    Device   = new Devices
                    {
                        Id           = Guid.NewGuid(),
                        Name         = "TasksDataDeviceAdd#2",
                        Model        = "TasksDataDeviceAdd#2",
                        Manufacturer = "TasksDataDeviceAdd#2",
                        User         = user
                    },
                }
            };

            TaskData taskDataDelete = new TaskData
            {
                Id    = taskDataIdDelete,
                Data  = onePlusJsonData,
                Tasks = new Tasks
                {
                    TaskType = Enums.TaskType.GetDeviceInfo,
                    Status   = Enums.Status.Completed,
                    Device   = new Devices
                    {
                        Id           = Guid.NewGuid(),
                        Name         = "TasksDataDeviceAdd#3",
                        Model        = "TasksDataDeviceAdd#3",
                        Manufacturer = "TasksDataDeviceAdd#3",
                        User         = user
                    },
                }
            };
            TaskData mapTaskData = new TaskData
            {
                Id    = Guid.NewGuid(),
                Data  = mapData,
                Tasks = new Tasks
                {
                    TaskType = Enums.TaskType.GetLocation,
                    Status   = Enums.Status.Completed,
                    Device   = new Devices
                    {
                        Id           = Guid.NewGuid(),
                        Name         = "TasksDataDeviceMap#4",
                        Model        = "TasksDataDeviceMap#4",
                        Manufacturer = "TasksDataDeviceMap#4",
                        User         = user
                    },
                }
            };

            UserRepository.Add(user, "test");
            TasksDataRepository.Add(taskData);
            TasksDataRepository.Add(taskDataUpdate);
            TasksDataRepository.Add(taskDataDelete);
            TasksDataRepository.Add(mapTaskData);
            Assert.Greater(TasksDataRepository.SaveChanges(), 0);
        }