Ejemplo n.º 1
0
        public void TestSearchWithPackageType()
        {
            var repository = new RepositoryArray();

            repository.AddPackage(Helper.MockPackage("foo", "1", type: PackageType.Library));
            repository.AddPackage(Helper.MockPackage("bar", "2", type: PackageType.Library));
            repository.AddPackage(Helper.MockPackage("foobar", "3", type: PackageType.Plugin));

            var searched = repository.Search("foo", SearchMode.Fulltext, PackageType.Library);

            Assert.AreEqual(1, searched.Length);
            Assert.AreEqual("foo", searched[0].GetName());
            Assert.AreEqual(null, searched[0].GetDescription());

            searched = repository.Search("bar", SearchMode.Fulltext, PackageType.Plugin);

            Assert.AreEqual(1, searched.Length);
            Assert.AreEqual("foobar", searched[0].GetName());
            Assert.AreEqual(null, searched[0].GetDescription());
        }
Ejemplo n.º 2
0
        public void TestSearch()
        {
            var repository = new RepositoryArray();

            repository.AddPackage(Helper.MockPackage("foo", "1"));
            repository.AddPackage(Helper.MockPackage("bar", "2"));

            var searched = repository.Search("foo", SearchMode.Fulltext);

            Assert.AreEqual(1, searched.Length);
            Assert.AreEqual("foo", searched[0].GetName());
            Assert.AreEqual(null, searched[0].GetDescription());

            searched = repository.Search("bar");

            Assert.AreEqual(1, searched.Length);
            Assert.AreEqual("bar", searched[0].GetName());
            Assert.AreEqual(null, searched[0].GetDescription());

            searched = repository.Search("foobar");
            Assert.AreEqual(0, searched.Length);
        }