public void GetAllEntries_Test() { // ARRANGE CreateEntries(); var entryLogic = new EntryLogic(); // ACT var entries = entryLogic.GetAllEntries().ToList(); entryLogic.Dispose(); // ASSERT Assert.IsNotNull(entries); Assert.IsTrue(entries.Count() == 3); }
private void LoadEntriesWhereFiltersHit() { var entryLogic = new EntryLogic(); this.EntryViewModels = entryLogic.GetAllEntries() .OrderByDescending(e => e.Created) .Select(e => new EntryViewModel(e)) .ToList(); entryLogic.Dispose(); Func <EntryViewModel, bool> projectCondition = e => e != null; Func <EntryViewModel, bool> assignmentCondition = e => e != null; Func <EntryViewModel, bool> subtaskCondition = e => e != null; if (this.SelectedProject != null) { if (this.SelectedProject.Id != 0) { projectCondition = e => e.ProjectId == this.SelectedProject.Id; } } if (this.SelectedAssignment != null) { if (this.SelectedAssignment.Id != 0) { assignmentCondition = e => e.Subtask.Assignment_Id == this.SelectedAssignment.Id; } } if (this.SelectedSubtask != null) { if (this.SelectedSubtask.Id != 0) { subtaskCondition = e => e.Subtask.Id == this.SelectedSubtask.Id; } } this.FilteredViewModels = this.EntryViewModels; this.FilteredViewModels = this.EntryViewModels.Where(projectCondition).ToList(); this.FilteredViewModels = this.FilteredViewModels.Where(assignmentCondition).ToList(); this.FilteredViewModels = this.FilteredViewModels.Where(subtaskCondition).ToList(); }