public void ContextSetup() { var masterModel = new MasterModel(); var server1 = masterModel.CreateCruiseServer(x => x.Url = "http://www.example.com/1"); var server2 = masterModel.CreateCruiseServer(x => x.Url = "http://www.example.com/2"); var ccReaderData = new Projects { Items = new[] { new ProjectsProject(), new ProjectsProject() } }; var mappedData = new CcProjectCollectionViewModel { Items = new[] { new CcProjectViewModel { Name = "Homer Wuz Here" } } }; var ccReaderResponse = NetworkResponse.Success(ccReaderData); var statusProvider = S <ISystemStatusProvider>(); statusProvider.Stub(x => x.GetSystemStatus()).Return(masterModel); var ccReader = S <ICcReader>(); ccReader.Stub(x => x.GetStatus("http://www.example.com/1")).Return(ccReaderResponse); var mapper = S <IMapper>(); mapper.Stub(x => x.Map <Projects, CcProjectCollectionViewModel>(ccReaderData)).Return(mappedData); var provider = new CruiseProjectModelProvider(ccReader, mapper, statusProvider); _result = provider.GetProjects(server1.Id); }
public void ContextSetup() { var masterModel = new MasterModel(); var server1 = masterModel.CreateCruiseServer(x => x.Url = "http://www.example.com/1"); var server2 = masterModel.CreateCruiseServer(x => x.Url = "http://www.example.com/2"); var ccReaderResponse = NetworkResponse.Fail <Projects>("Network request failed.", new Exception("I don't wanna")); var statusProvider = S <ISystemStatusProvider>(); statusProvider.Stub(x => x.GetSystemStatus()).Return(masterModel); var ccReader = S <ICcReader>(); ccReader.Stub(x => x.GetStatus("http://www.example.com/1")).Return(ccReaderResponse); IMapper doNotUseMapper = null; var provider = new CruiseProjectModelProvider(ccReader, doNotUseMapper, statusProvider); _result = provider.GetProjects(server1.Id); }