コード例 #1
0
        public void Should_Indicate_That_The_User_Is_Not_Using_Chrome()
        {
            var handler = new PublicGetHandler(new MemoryRepository<DirectoryEntry>());

            var viewModel = handler.Execute(new GetRequest { UserAgent = "Mozilla/6.0 (Macintosh; I; Intel Mac OS X 11_7_9; de-LI; rv:1.9b4) Gecko/2012010317 Firefox/10.0a4" });

            viewModel.IsChromeBrowser.ShouldBeFalse();
        }
コード例 #2
0
        public void Should_Indicate_That_The_User_Is_Using_Chrome()
        {
            var handler = new PublicGetHandler(new MemoryRepository<DirectoryEntry>());

            var viewModel = handler.Execute(new GetRequest { UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.77 Safari/535.7" });

            viewModel.IsChromeBrowser.ShouldBeTrue();
        }
コード例 #3
0
        public void Should_Return_The_First_Twenty_Directory_Results()
        {
            var repository = new MemoryRepository<DirectoryEntry>(Enumerable.Range(0, 30).Select(x => new DirectoryEntry()));
            var handler = new PublicGetHandler(repository);

            var viewModel = handler.Execute(new GetRequest {UserAgent = "" });

            viewModel.Results.Count.ShouldEqual(20);
        }
コード例 #4
0
        public void Should_Blow_Up_If_User_Is_Using_Internet_Explorer()
        {
            var handler = new PublicGetHandler(new MemoryRepository<DirectoryEntry>());

            Assert.Throws<Exception>(() => handler.Execute(new GetRequest { UserAgent = "Mozilla/5.0 (Windows; U; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)" }));
        }