コード例 #1
0
            public BaseFacts()
            {
                _auxiliaryDataCache = new Mock <IAuxiliaryDataCache>();
                _searchService      = new Mock <ISearchService>();
                _statusService      = new Mock <ISearchStatusService>();

                _v2SearchResponse = new V2SearchResponse();
                _v3SearchResponse = new V3SearchResponse();

                _searchService
                .Setup(x => x.V2SearchAsync(It.IsAny <V2SearchRequest>()))
                .ReturnsAsync(() => _v2SearchResponse);
                _searchService
                .Setup(x => x.V3SearchAsync(It.IsAny <V3SearchRequest>()))
                .ReturnsAsync(() => _v3SearchResponse);
                _searchService
                .Setup(x => x.AutocompleteAsync(It.IsAny <AutocompleteRequest>()))
                .ReturnsAsync(() => _autocompleteResponse);

                _target = new SearchController(
                    _auxiliaryDataCache.Object,
                    _searchService.Object,
                    _statusService.Object);

                _target.Request       = new HttpRequestMessage();
                _target.Configuration = new HttpConfiguration();
                WebApiConfig.SetSerializerSettings(_target.Configuration.Formatters.JsonFormatter.SerializerSettings);
            }
コード例 #2
0
            public BaseFacts()
            {
                _auxiliaryDataCache = new Mock <IAuxiliaryDataCache>();
                _searchService      = new Mock <ISearchService>();
                _statusService      = new Mock <ISearchStatusService>();

                _v2SearchResponse = new V2SearchResponse();
                _v3SearchResponse = new V3SearchResponse();

                _searchService
                .Setup(x => x.V2SearchAsync(It.IsAny <V2SearchRequest>()))
                .ReturnsAsync(() => _v2SearchResponse);
                _searchService
                .Setup(x => x.V3SearchAsync(It.IsAny <V3SearchRequest>()))
                .ReturnsAsync(() => _v3SearchResponse);
                _searchService
                .Setup(x => x.AutocompleteAsync(It.IsAny <AutocompleteRequest>()))
                .ReturnsAsync(() => _autocompleteResponse);

                _target = new SearchController(
                    _auxiliaryDataCache.Object,
                    _searchService.Object,
                    _statusService.Object);
            }