示例#1
0
        public void TagController_Search_ShouldCallTagServiceSearch()
        {
            var tagService = A.Fake<ITagAdminService>();
            var tagController = new TagController(tagService);

            tagController.Search( "test");

            A.CallTo(() => tagService.Search("test")).MustHaveHappened();
        }
示例#2
0
        public void TagController_Search_ShouldReturnTheResultOfTheServiceQuery()
        {
            var tagService = A.Fake<ITagAdminService>();
            var tagController = new TagController(tagService);
            IEnumerable<AutoCompleteResult> results = Enumerable.Empty<AutoCompleteResult>();
            A.CallTo(() => tagService.Search("test")).Returns(results);

            JsonResult result = tagController.Search("test");
            result.Data.As<IEnumerable<AutoCompleteResult>>().Should().BeEquivalentTo(results);
        }