Beispiel #1
0
        public void TestGetRandom(DicewareFileType fileType, DicewareIndexLength index, int count)
        {
            var repo = new FilePhraseRepository(this.sysConfig.GetPathForFileType(fileType), index, this.util);

            var result = repo.GetRandom(count);

            Assert.AreEqual(count, result.Count, "Assert that the returned number of items matches expectations.");
        }
Beispiel #2
0
        public void TestInterface()
        {
            var repo = new FilePhraseRepository(this.sysConfig.GetPathForFileType(DicewareFileType.Short), DicewareIndexLength.Short, this.util);

            Assert.IsInstanceOf(typeof(IPhraseRepository), repo, "Assert that the repository implements the expected interface.");
        }
Beispiel #3
0
        public void TestInvalidRange(DicewareFileType fileType, DicewareIndexLength index)
        {
            var repo = new FilePhraseRepository(this.sysConfig.GetPathForFileType(fileType), index, this.util);

            Assert.Throws <ArgumentOutOfRangeException>(() => repo.GetRandom(0), "Assert that the count value must be greater than zero.");
        }