public void SaveFile_ResultCorrectValue() { //Setup var project = ToolsProject.CreateNotes(); var expected = File.ReadAllText(_pathTestData + _fileName); //Act ProjectManager.SaveFile(project, _pathOutput + _fileName); ////Assert var actual = File.ReadAllText(_pathOutput + _fileName); Assert.AreEqual(expected, actual); }
public void LoadFile_ResultCorrectValue() { //Setup var expectedProject = ToolsProject.CreateNotes(); //Act var actualProject = ProjectManager.LoadFile(_pathTestData + _fileName); //Assert Assert.AreEqual(actualProject.Notes.Count, expectedProject.Notes.Count); Assert.Multiple(() => { for (int i = 0; i < expectedProject.Notes.Count; i++) { var expected = expectedProject.Notes[i]; var actual = actualProject.Notes[i]; Assert.AreEqual(expected, actual); } }); }
public void TestFilterProjectByCategory() { //Setup var project = ToolsProject.CreateNotes(); project.Notes = Project.FilterProjectByCategory(project.Notes, NoteCategory.Work); bool isFiltring = true; //Act for (int i = 1; i < project.Notes.Count; i++) { if (project.Notes[i].Category != project.Notes[i - 1].Category) { isFiltring = false; break; } } //Assert Assert.AreEqual(isFiltring, true, "Filter list incorrect"); }
public void TestSortProjectByModified() { //Setup var project = ToolsProject.CreateNotes(); project.Notes = Project.SortProjectByModified(project.Notes); bool isSorting = true; //Act for (int i = 1; i < project.Notes.Count; i++) { if (project.Notes[i].Modified.CompareTo(project.Notes[i - 1].Modified) > 0) { isSorting = false; break; } } //Assert Assert.AreEqual(isSorting, true, "Sort list incorrect"); }