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); } }
public void Save(Task task) { if (task.Id == 0) { task.CreatedDate = DateTime.UtcNow; _context.Tasks.InsertOnSubmit(task); } _context.SubmitChanges(); }
public void Delete(Task task) { _context.Tasks.DeleteOnSubmit(task); _context.SubmitChanges(); }
private void detach_Tasks(Task entity) { this.SendPropertyChanging(); entity.User = null; }
private void attach_Tasks(Task entity) { this.SendPropertyChanging(); entity.User = this; }
partial void DeleteTask(Task instance);
partial void UpdateTask(Task instance);
partial void InsertTask(Task instance);
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); } }
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); } }