Пример #1
0
        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);
        }
Пример #2
0
        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);
                }
            });
        }
Пример #3
0
        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");
        }
Пример #4
0
        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");
        }