コード例 #1
0
        public void listDictsWithoutPath()
        {
            List <VoikkoDictionary> dicts = Voikko.listDicts();

            Assert.IsTrue(dicts.Count > 0);
            VoikkoDictionary standard = dicts[0];

            Assert.AreEqual("standard", standard.Variant);
        }
コード例 #2
0
        public void dictionaryHashCodeWorks()
        {
            VoikkoDictionary d1 = new VoikkoDictionary("fi", "a", "b");
            VoikkoDictionary d2 = new VoikkoDictionary("fi", "a", "c");
            VoikkoDictionary d3 = new VoikkoDictionary("fi", "c", "b");
            VoikkoDictionary d4 = new VoikkoDictionary("fi", "a", "b");
            VoikkoDictionary d5 = new VoikkoDictionary("sv", "a", "b");

            Assert.AreNotEqual(d1.GetHashCode(), d2.GetHashCode());
            Assert.AreNotEqual(d1.GetHashCode(), d3.GetHashCode());
            Assert.AreNotEqual(d4.GetHashCode(), d5.GetHashCode());
            Assert.AreEqual(d1.GetHashCode(), d4.GetHashCode());
        }
コード例 #3
0
        public void dictionaryComparisonWorks()
        {
            VoikkoDictionary d1 = new VoikkoDictionary("fi", "a", "b");
            VoikkoDictionary d2 = new VoikkoDictionary("fi", "a", "c");
            VoikkoDictionary d3 = new VoikkoDictionary("fi", "c", "b");
            VoikkoDictionary d4 = new VoikkoDictionary("fi", "a", "b");
            VoikkoDictionary d5 = new VoikkoDictionary("sv", "a", "b");

            Assert.IsFalse(d1.Equals("kissa"));
            Assert.IsFalse("kissa".Equals(d1));
            Assert.IsFalse(d1.Equals(d2));
            Assert.IsFalse(d1.Equals(d3));
            Assert.IsFalse(d4.Equals(d5));
            Assert.IsTrue(d1.Equals(d4));
            Assert.IsTrue(d1.CompareTo(d2) < 0);
            Assert.IsTrue(d2.CompareTo(d3) < 0);
            Assert.IsTrue(d4.CompareTo(d5) < 0);
        }