public void GetBreeds_Returns_EmptyList_When_No_Data_Returned() { // arrange var stubJsonSerializerWrapper = MockRepository.GenerateMock<IDataContractJsonSerializerWrapper>(); stubJsonSerializerWrapper.Stub(x => x.ReadObject(Arg<Stream>.Is.Anything, Arg<DataContractJsonSerializer>.Is.Anything)).Return(null); var searchRepository = new SearchAPIFacade(stubJsonSerializerWrapper, _exceptionHandler, _configMgr, _webAPIRequestWrapper, _responseStreamHelper); // act var result = searchRepository.GetBreeds().ToList(); // assert Assert.That(result.Count == 0); }
public void GetBreeds_Returns_List_Breeds() { // arrange var stubJsonSerializerWrapper = MockRepository.GenerateMock<IDataContractJsonSerializerWrapper>(); stubJsonSerializerWrapper.Stub(x => x.ReadObject(Arg<Stream>.Is.Anything, Arg<DataContractJsonSerializer>.Is.Anything)).Return(_breedsList); var searchRepository = new SearchAPIFacade(stubJsonSerializerWrapper, _exceptionHandler, _configMgr, _webAPIRequestWrapper, _responseStreamHelper); // act var result = searchRepository.GetBreeds().ToList(); // assert Assert.That(result.First().Id == 1 && result.First().Name == "Dalmatian"); Assert.That(result.Count == _breedsList.Count); }