public void SetUp() { _request = MockRepository.GenerateMock <HttpRequestBase>(); _request.Stub(arg => arg.ContentType).Return("application/json"); _context = MockRepository.GenerateMock <HttpContextBase>(); _context.Stub(arg => arg.Request).Return(_request); _mapper = new JsonModelMapper(); }
public void SetUp() { _request = MockRepository.GenerateMock <HttpRequestBase>(); _request.Stub(arg => arg.ContentType).Return("application/json"); _context = MockRepository.GenerateMock <HttpContextBase>(); _context.Stub(arg => arg.Request).Return(_request); _mapper = new JsonModelMapper(type => _executed = true); _mapper.CanMapTypeAsync(_context, typeof(object)).Wait(); }
public void SetUp() { _request = MockRepository.GenerateMock <HttpRequestBase>(); _request.Stub(arg => arg.ContentEncoding).Return(Encoding.ASCII); _request.Stub(arg => arg.ContentType).Return("application/json"); _request.Stub(arg => arg.InputStream).Return(new MemoryStream(Encoding.ASCII.GetBytes("{"))); _context = MockRepository.GenerateMock <HttpContextBase>(); _context.Stub(arg => arg.Request).Return(_request); _mapper = new JsonModelMapper(); }
public Detail() { InitializeComponent(); HurriyetApi api = new HurriyetApi(); var articlesJson = api.Get($"v1/articles/40518710"); JsonModelMapper <ArticlesDetailModel> jsonModel = new JsonModelMapper <ArticlesDetailModel>(); var article = jsonModel.GetItem(articlesJson); cvImages.ItemsSource = article.Files; lblTitle.Text = article.Title; }
public Articles() { InitializeComponent(); HurriyetApi api = new HurriyetApi(); var articlesJson = api.Get("v1/articles"); JsonModelMapper <ArticlesModel> jsonModel = new JsonModelMapper <ArticlesModel>(); var articles = jsonModel.GetList(articlesJson); var items = articles .Where(q => q.Files.Count > 0) .Select(s => new ArticlesListViewModel { Id = s.Id, FileUrl = s.Files.FirstOrDefault().FileUrl, Title = s.Title, Path = $"{s.Path.TagSubstring()} - {s.ModifiedDate.ToDate().ToString("dd.MM.yyyy HH:ss")}", Tags = s.Tags.Count > 0 ? $"Tags : {s.Tags.StringListToString()}" : string.Empty }).Take(10).ToList(); listView.ItemsSource = items; listView.ItemSelected += ListView_ItemSelected; }