Exemplo n.º 1
0
 public void SearchingIssues(IssuesState issuesState)
 {
     "Given existing issues".
     f(() => MockIssueStore.Setup(i => i.FindAsyncQuery("another")).Returns(Task.FromResult(FakeIssues.Where(i => i.Id == "2"))));
     "When issues are searched".
     f(() =>
     {
         Request.RequestUri = new Uri(_uriIssues, "?searchtext=another");
         Response           = Client.SendAsync(Request).Result;
         issuesState        = Response.Content.ReadAsAsync <IssuesState>().Result;
     });
     "Then a '200 OK' status is returned".
     f(() => Response.StatusCode.ShouldEqual(HttpStatusCode.OK));
     "Then the collection should have a 'self' link".
     f(() =>
     {
         var link = issuesState.Links.FirstOrDefault(l => l.Rel == IssueLinkFactory.Rels.Self);
         link.ShouldNotBeNull();
         link.Href.AbsoluteUri.ShouldEqual("http://localhost/issue?searchtext=another");
     });
     "Then the matching issues are returned".
     f(() =>
     {
         var issue = issuesState.Issues.FirstOrDefault();
         issue.ShouldNotBeNull();
         issue.Id.ShouldEqual("2");
     });
 }
Exemplo n.º 2
0
 public void RetrievingAllIssues(IssuesState issuesState)
 {
     "Given existing issues".
     f(() => MockIssueStore.Setup(i => i.FindAsync()).Returns(Task.FromResult(FakeIssues)));
     "When all issues are retrieved".
     f(() =>
     {
         Request.RequestUri = _uriIssues;
         Response           = Client.SendAsync(Request).Result;
         issuesState        = Response.Content.ReadAsAsync <IssuesState>().Result;
     });
     "Then a '200 OK' status is returned".
     f(() => Response.StatusCode.ShouldEqual(HttpStatusCode.OK));
     "Then they are returned".
     f(() =>
     {
         issuesState.Issues.FirstOrDefault(i => i.Id == "1").ShouldNotBeNull();
         issuesState.Issues.FirstOrDefault(i => i.Id == "2").ShouldNotBeNull();
     });
     "Then the collection should have a 'self' link".
     f(() =>
     {
         var link = issuesState.Links.FirstOrDefault(l => l.Rel == IssueLinkFactory.Rels.Self);
         link.ShouldNotBeNull();
         link.Href.AbsoluteUri.ShouldEqual("http://localhost/issue");
     });
 }
Exemplo n.º 3
0
        public async Task <HttpResponseMessage> Get()
        {
            var result = await _store.FindAsync();

            var issuesState = new IssuesState();

            issuesState.Issues = result.Select(i => _stateFactory.Create(i));
            return(Request.CreateResponse(HttpStatusCode.OK, issuesState));
        }
Exemplo n.º 4
0
        public async Task <HttpResponseMessage> GetSearch(string searchText)
        {
            var issues = await _store.FindAsyncQuery(searchText);

            var issuesState = new IssuesState();

            issuesState.Issues = issues.Select(i => _stateFactory.Create(i));
            issuesState.Links.Add(new Link {
                Href = Request.RequestUri, Rel = LinkFactory.Rels.Self
            });
            return(Request.CreateResponse(HttpStatusCode.OK, issuesState));
        }
Exemplo n.º 5
0
 void WhenAllIssuesAreRetrieved()
 {
     Request.RequestUri = _uriIssues;
     Response           = Client.SendAsync(Request).Result;
     _issuesState       = Response.Content.ReadAsAsync <IssuesState>().Result;
 }
 protected HttpResponseMessage GetIssuesList(IssuesFilter issuesFilter, IssuesState issuesState, IssuesLabels issuesLabels,
                                             IssuesSort issuesSort, IssuesDirection issuesDirection, IssuesSince issuesSince)
 {
     ;
 }