public void RestrictedCollectionWorksWithCertificate()
        {
            var Search2 = new PlainSearch(new Settings("authoring-hss.cp-access.com", "https://searchg2-restricted.crownpeak.net/", CertificateCreator.LoadCertificate("E63D2DCEB03E981968F373F5C419E043D9394AF9")));
            var results = Search2.Execute("*:*");

            Assert.AreEqual(results.TotalCount, 13, "Expected 13 results, found " + results.TotalCount);
        }
        public void RestrictedCollectionFailsWithoutCertificate()
        {
            var Search2 = new PlainSearch(new Settings("authoring-hss.cp-access.com", "https://searchg2-restricted.crownpeak.net/", null));
            var results = Search2.Execute("*:*");

            Assert.AreEqual(results.TotalCount, 0, "Expected 0 results, found " + results.TotalCount);
        }
 public void TimingOutReturnsTimeoutError()
 {
     //try
     //{
     //	ClearContainer();
     //	var container = Startup.Container;
     //	container.Register<IEndPointConfiguration>(c => new TimeoutTestEndPointConfiguration());
     //	ServiceLocator.SetLocatorProvider(() => container);
     //}
     //catch (Exception)
     //{
     //	// Ignore
     //}
     try
     {
         var s       = new PlainSearch(new Settings("www.crownpeak.com", _endpoint, 1));
         var results = s.Execute("crownpeak");
         Assert.IsTrue(results.Count == 10, "Expected 10 results, got " + results.Count);
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         // Restore the state
         SetupSearch();
     }
 }
 public void InvalidCollectionReturnsError()
 {
     //try
     //{
     //	ClearContainer();
     //	var container = Startup.Container;
     //	container.Register<IEndPointConfiguration>(c => new TestEndPointConfiguration());
     //	ServiceLocator.SetLocatorProvider(() => container);
     //}
     //catch (Exception)
     //{
     //	// Ignore
     //}
     try
     {
         var s       = new PlainSearch(new Settings("a-collection-that-does-not-exist"));
         var results = s.Execute("crownpeak");
         Assert.IsTrue(results.Count == 10, "Expected 10 results, got " + results.Count);
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         // Restore the state
         SetupSearch();
     }
 }
示例#5
0
        public void SearchAllFindsAllContent()
        {
            var results = PlainSearch.Execute();

            Assert.IsTrue(results.Count == 10, "Expected 10 results, found " + results.Count);
            Assert.IsTrue(results.TotalCount == 98, "Expected 98 total results, found " + results.TotalCount);
        }
        public void QueryAllFindsResults()
        {
            var results = PlainSearch.Execute();

            Assert.IsTrue(results.Count > 0, "No results found");
            Assert.IsTrue(results.Count == 10, "Too few/many results returned, expected 10 found " + results.Count);
            Assert.IsTrue(results.TotalCount == 182, "Too few/many results in total, expected 182 found " + results.TotalCount);
            Assert.IsTrue(results[0].ContainsKey("id"), "No id field returned");
        }