Ejemplo n.º 1
0
        public void SortErrorTest()
        {
            List <SearchProject> searchProjects     = new List <SearchProject>();
            SearchProject        test2SearchProject = new SearchProject()
            {
                year        = "1970",
                director    = "Троицкий",
                diamAntenna = 14,
                frequency   = 1875
            };

            searchProjects.Add(test2SearchProject);
            SearchProject testSearchProject = new SearchProject()
            {
                year        = "1960",
                director    = "Дрейк",
                diamAntenna = 26,
                frequency   = 1420
            };

            searchProjects.Add(testSearchProject);

            ISearchProjectListSaver saver = new SearchProjectListSplitFileSaver("NewSearchProject.txt");

            saver.SaveFile(searchProjects);

            ISearchProjectListLoader loader = new SearchProjectListSplitFileLoader("NewSearchProject.txt");

            loader.Execute();
            Assert.ThrowsException <Exception>(() => {
                loader.Sort();
            });
        }
Ejemplo n.º 2
0
        public void SortByFrequencyListTest()
        {
            List <SearchProject> searchProjects     = new List <SearchProject>();
            SearchProject        test2SearchProject = new SearchProject()
            {
                year        = "1970",
                director    = "Троицкий",
                diamAntenna = 14,
                frequency   = 1875
            };

            searchProjects.Add(test2SearchProject);
            SearchProject testSearchProject = new SearchProject()
            {
                year        = "1960",
                director    = "Дрейк",
                diamAntenna = 26,
                frequency   = 1420
            };

            searchProjects.Add(testSearchProject);

            ISearchProjectListSaver saver = new SearchProjectListSplitFileSaver("NewSearchProject.txt");

            saver.SaveFile(searchProjects);

            ISearchProjectListLoader loader = new SearchProjectListSplitFileLoader("NewSearchProject.txt");

            loader.Execute();
            loader.Sort("frequency");
            Assert.AreEqual(loader.searchProjectList[0].frequency, 1420);
            File.WriteAllText("NewSearchProject.txt", "");
        }