예제 #1
0
        public void DeleteTasks()
        {
            using (var fixture = new FixtureInit("http://localhost"))
            {
                //INIT
                var repository = new TasksRepository(fixture.Setup.Context);

                var task = new Task()
                {
                    Number = 0,
                    UserId = fixture.Setup.User.Id,
                    Description = "My new task",
                    Status = 0,
                    ActualWork = 0
                };

                repository.Save(task);

                //ACT
                repository.Delete(task);

                //POST
                var foundTask = repository.Tasks.WithId(task.Id);
                Assert.That(foundTask, Is.Null);
            }
        }
예제 #2
0
 public void Save(Task task) 
 {
     if (task.Id == 0)
     {
         task.CreatedDate = DateTime.UtcNow;
         _context.Tasks.InsertOnSubmit(task);
     }
     _context.SubmitChanges();
 }
예제 #3
0
        public void Delete(Task task)
        {

            _context.Tasks.DeleteOnSubmit(task);
            _context.SubmitChanges();
        }
예제 #4
0
		private void detach_Tasks(Task entity)
		{
			this.SendPropertyChanging();
			entity.User = null;
		}
예제 #5
0
		private void attach_Tasks(Task entity)
		{
			this.SendPropertyChanging();
			entity.User = this;
		}
예제 #6
0
 partial void DeleteTask(Task instance);
예제 #7
0
 partial void UpdateTask(Task instance);
예제 #8
0
 partial void InsertTask(Task instance);
예제 #9
0
        public void Tasks_DoneFlag_Set()
        {
            using (var fixture = new FixtureInit("http://localhost"))
            {
                // arrange
                var repository = new TasksRepository(fixture.Setup.Context);

                var task = new Task
                {
                    Description = "Test task",
                    UserId = fixture.Setup.User.Id,
                    Done = true
                };

                // act
                repository.Save(task);

                // assert
                var savedTask = repository.Tasks.Where(t => t.Id == task.Id).SingleOrDefault();
                Assert.That(savedTask.Done, Is.True);
            }

        }
예제 #10
0
        public void Save_CreatedDateInitialized_TaskSavedWithCreatedDate()
        {
            using (var fixture = new FixtureInit("http://localhost"))
            {
                // arrange
                var repository = new TasksRepository(fixture.Setup.Context);

                // act
                var task = new Task { UserId = fixture.Setup.User.Id, Description = "created date test" };
                repository.Save(task);

                // assert
                var found = repository.Tasks.Where(t => t.Description == "created date test").SingleOrDefault();
                Assert.That(found.CreatedDate, Is.Not.Null);
            }
        }