public void GetByProjectIdShouldReturnOkResultWithData()
 {
     controller
     .Calling(c => c.GetByProjectId(1))
     .ShouldReturn()
     .Ok()
     .WithResponseModelOfType <List <ListedCommitResponseModel> >()
     .Passing(m => m.Count == 1);
 }
 public void CommentsControllerShouldHaveAuthorizedHttpGetRouteAndValidateTakeAttribute()
 {
     controller
     .Calling(c => c.ByUser(With.Any <string>(), With.Any <int>(), With.Any <int>()))
     .ShouldHave()
     .ActionAttributes(attrs => attrs
                       .RestrictingForRequestsWithMethod(HttpMethod.Get)
                       .ChangingRouteTo("api/Comments/ByUser/{id}")
                       .ContainingAttributeOfType <ValidateTakeAttribute>());
 }
 public void ReturnProjectIdPutActionOnAProjectNotBeingWorkedOn()
 {
     controller
     .Calling(c => c.Put(25))
     .ShouldHave()
     .ActionAttributes(attr => attr.RestrictingForAuthorizedRequests())
     .AndAlso()
     .ShouldReturn()
     .Ok()
     .WithResponseModel(25);
 }
Example #4
0
 public void TestGetAllMethod()
 {
     _controller
     .Calling(controller => controller.Get())
     .ShouldReturn()
     .Ok()
     .WithResponseModelOfType <IEnumerable <string> >()
     .Passing(response =>
     {
         Assert.NotEmpty(response);
     }
              );
 }
Example #5
0
 public void UserGetSuggestionsShouldNotReturnWaitingForApproveAndNotApprovedSuggestions()
 {
     var commentHttpResult = controller
                             .Calling(c => c.Get(1, 20, "DateCreated", null, null, false, false))
                             .ShouldReturn()
                             .Ok();
 }
Example #6
0
 public void GetShouldHaveCorsEnabled()
 {
     controller
     .Calling(c => c.Get())
     .ShouldHave()
     .ActionAttributes(attr => attr.ContainingAttributeOfType <EnableCorsAttribute>());
 }
Example #7
0
 public void GetShouldReturnOK()
 {
     controller
     .Calling(c => c.Get(1))
     .ShouldReturn()
     .Ok()
     .WithResponseModelOfType <List <PublicGameResponseModel> >()
     .Passing(model =>
     {
         Assert.AreEqual(1, model.Count);
     });
 }
Example #8
0
 public void GetShouldReturnZeroComemnts()
 {
     controller
     .Calling(c => c.GetByUser("someRandomUser", 0, 1))
     .ShouldReturn()
     .Ok()
     .WithResponseModelOfType <List <CommentResponseModel> >()
     .Passing(model =>
     {
         Assert.AreEqual(0, model.Count);
     });
 }
        public void GetShouldReturnCorrectHighScore()
        {
            controller
            .Calling(c => c.Get())
            .ShouldReturn()
            .Ok()
            .WithResponseModelOfType <List <HighScoreResponseModel> >()
            .Passing(model =>
            {
                Assert.AreEqual(10, model.Count);

                var current = model.First().Rank;
                for (int i = 1; i < model.Count; i++)
                {
                    Assert.IsTrue(model[i].Rank <= current);
                    current = model[i].Rank;
                }
            });
        }