Exemplo n.º 1
0
        public async Task Should_Not_Register_With_Invalid_User()
        {
            var input = new RegisterInput
            {
                Email    = new string('*', 300),
                UserName = new string('*', 300),
                Password = "******"
            };

            var response = await TestServer.CreateClient().PostAsync("/api/register",
                                                                     input.ToStringContent(Encoding.UTF8, "application/json"));

            Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
        }
Exemplo n.º 2
0
        public async Task Should_Register()
        {
            var registerInput = new RegisterInput
            {
                Email    = "TestUserEmail_" + Guid.NewGuid() + "@mail.com",
                UserName = "******" + Guid.NewGuid(),
                Password = "******"
            };

            var responseRegister = await TestServer.CreateClient().PostAsync("/api/register",
                                                                             registerInput.ToStringContent(Encoding.UTF8, "application/json"));

            Assert.Equal(HttpStatusCode.OK, responseRegister.StatusCode);
        }
Exemplo n.º 3
0
        public async Task Should_Not_Register_With_Existing_User()
        {
            var registerInput = new RegisterInput
            {
                Email    = DbContextDataSeeder.AdminUserEmail,
                UserName = DbContextDataSeeder.AdminUserName,
                Password = "******"
            };

            var responseRegister = await TestServer.CreateClient().PostAsync("/api/register",
                                                                             registerInput.ToStringContent(Encoding.UTF8, "application/json"));

            Assert.Equal(HttpStatusCode.Conflict, responseRegister.StatusCode);
        }
Exemplo n.º 4
0
        public async Task Should_Not_Register_With_Existing_User()
        {
            var registerInput = new RegisterInput
            {
                Email    = DefaultUsers.TestAdmin.Email,
                UserName = DefaultUsers.TestAdmin.UserName,
                Password = "******"
            };

            var responseRegister = await TestServer.CreateClient().PostAsync("/api/account/register",
                                                                             registerInput.ToStringContent(Encoding.UTF8, "application/json"));

            Assert.Equal(HttpStatusCode.BadRequest, responseRegister.StatusCode);
        }