Example #1
0
 public void should_update_settings()
 {
     _app.ShouldPost("/user/settings",
                     new
     {
         DisplayName  = "三毛",
         EmailAddress = "*****@*****.**"
     },
                     SigninRequired);
 }
        void should_send_reset_password_email()
        {
            var user = CreateUser();
            var mailDeliveryMethod = new Mock <IEmailDeliveryMethod>();

            mailDeliveryMethod.Setup(sender => sender.SendEmailAsync(
                                         It.IsAny <string>(),
                                         It.IsAny <string>(),
                                         It.IsAny <string>()))
            .Returns(Task.CompletedTask);
            _app.OverrideServices(services => services.AddSingleton(mailDeliveryMethod.Object));

            _app.ShouldPost("/forgot-password",
                            new ForgotPasswordModel {
                UsernameOrEmail = user.UserName
            },
                            signinStatus: SigninRequirement.SigninNotRequired)
            .WithApiResult((api, _) => api.HasSucceeded.ShouldEqual(true));
        }
Example #3
0
        public void should_reply_a_topic_by_an_authorized_user()
        {
            var topic = _app.NewTopic().Create();

            _app.ShouldPost($"/topics/{topic.Id}/replies",
                            new
            {
                Content = "reply content"
            },
                            SigninRequired);
        }
Example #4
0
 public void should_accept_create_topic_request_with_valid_post_data()
 {
     _app.ShouldPost("/topics",
                     new
     {
         title   = "中文的 title",
         content = "some content",
         type    = "1"
     },
                     SigninRequired)
     .WithResponse(res =>
     {
         res.StatusCode.ShouldEqual(HttpStatusCode.Redirect);
         res.Headers.Location.ShouldNotBeNull();
         res.Headers.Location.ToString().ShouldContain("/topics/", StringComparison.OrdinalIgnoreCase);
     });
 }