Пример #1
0
        public void exception_missing_params_for_search()
        {
            // arrange
            var engine = new TestSearchEngine();

            // act
            var result = engine.Search("");

            // assert - Expects exception
        }
Пример #2
0
        public void exception_all_result()
        {
            // arrange
            var engine = new TestSearchEngine();

            // act
            var result = engine.GetAllResult();

            // assert - Expects exception
        }
Пример #3
0
        public void cached_top_result()
        {
            // arrange
            var engine = new TestSearchEngine();

            engine.SetTestCachedResults("Test1", 1);
            engine.SetTestCachedResults("Test2", 2);
            engine.SetTestCachedResults("Test3", 3);
            var expectedResult = "Test3";

            // act
            var result = engine.GetTopResult();

            // assert
            Assert.IsTrue(expectedResult == result);
        }
Пример #4
0
        public void cached_all_result()
        {
            // arrange
            var engine = new TestSearchEngine();

            engine.SetTestCachedResults("Test1", 1);
            engine.SetTestCachedResults("Test2", 2);
            engine.SetTestCachedResults("Test3", 3);
            var expectedResult = new Dictionary <string, ulong>();

            expectedResult.Add("Test1", 1);
            expectedResult.Add("Test2", 2);
            expectedResult.Add("Test3", 3);

            // act
            var result = engine.GetAllResult();

            // assert
            Assert.IsTrue(result.SequenceEqual(result));
        }