Пример #1
0
        public void CollectAllTheClues_NoAssertions()
        {
            const string DIRECTORY_WITH_PUZ_FILES =
                @"C:\Users\Chip\Source\Repos\WordPuzzle3\WordPuzzlesTest\data\PUZ";

            ClueRepository clues = new ClueRepository();

            clues.ReadFromDisk();
            foreach (string file in Directory.EnumerateFiles(DIRECTORY_WITH_PUZ_FILES, "*.json"))
            {
                Console.WriteLine($"Adding {file}, words so far {clues.CountOfWordWithClues}.");
                clues.ReadFromDisk(file);
            }
            // ReSharper disable StringLiteralTypo
            clues.WriteToDisk(DIRECTORY_WITH_PUZ_FILES + @"\allclues.json");
            // ReSharper restore StringLiteralTypo
        }
Пример #2
0
            public void EmptyRepository_CreatesExpectedFile()
            {
                ClueRepository repository = new ClueRepository();

                // ReSharper disable StringLiteralTypo
                repository.WriteToDisk(@"data\actual_empty_clue_repository.json");
                // ReSharper restore StringLiteralTypo

                var expectedLines = File.ReadAllLines(@"data\expected_empty_clue_repository.json");
                var actualLines   = File.ReadAllLines(@"data\actual_empty_clue_repository.json");

                for (var index = 0; index < expectedLines.Length; index++)
                {
                    string expectedLine = expectedLines[index];
                    string actualLine   = actualLines[index];
                    Assert.AreEqual(expectedLine, actualLine, $"Unexpected line at index {index}");
                }
            }
Пример #3
0
            public void MultipleClues_CreatesExpectedFile()
            {
                ClueRepository repository = new ClueRepository();

                repository.AddClue("ONES", "Singletons");
                repository.AddClue("ONES", "Smallest denomination of folding money.");

                repository.AddClue("Lego", "A small colorful brick.", ClueSource.ClueSourceChip);

                // ReSharper disable StringLiteralTypo
                repository.WriteToDisk(@"data\actual_nonempty_clue_repository.json");
                // ReSharper restore StringLiteralTypo

                var expectedLines = File.ReadAllLines(@"data\expected_nonempty_clue_repository.json");
                var actualLines   = File.ReadAllLines(@"data\actual_nonempty_clue_repository.json");

                for (var index = 0; index < expectedLines.Length; index++)
                {
                    string expectedLine = expectedLines[index];
                    string actualLine   = actualLines[index];
                    Assert.AreEqual(expectedLine, actualLine, $"Unexpected line at index {index}");
                }
            }