コード例 #1
0
        public async Task Register_User_When_Invalid(String email, String password, int role)
        {
            var assertDatabase = await RfidDatabaseAssert.CreateAsync();

            using (var response = await RfidHttpClient.PostAsync(registerUserSubPath, CreateUser(email, password, (UserRoles)role)))
            {
                AssertHttpResponse(response, HttpStatusCode.BadRequest);
            }

            await assertDatabase.AssertCntAsync();
        }
コード例 #2
0
        public async Task Register_User()
        {
            var assertDatabase = await RfidDatabaseAssert.CreateAsync();

            var requestModel = Examples.Administrator();

            using (var response = await RfidHttpClient.PostAsync(registerUserSubPath, requestModel))
            {
                AssertHttpResponse(response, HttpStatusCode.OK);
            }

            await assertDatabase.AssertCntAsync(requestModel);
        }
コード例 #3
0
        public async Task Register_User_When_Already_Registered()
        {
            var assertDatabase = await RfidDatabaseAssert.CreateAsync();

            var requestModel = Examples.Administrator();

            using (var response = await RfidHttpClient.PostAsync(registerUserSubPath, requestModel))
            {
                AssertHttpResponse(response, HttpStatusCode.OK);
            }

            using (var response = await RfidHttpClient.PostAsync(registerUserSubPath, requestModel))
            {
                await AssertHttpResponseAsync(response, HttpStatusCode.BadRequest, (false, CommandStatus.Dublicate));
            }

            await assertDatabase.AssertCntAsync(requestModel);
        }
コード例 #4
0
        public async Task Register_Several_Users()
        {
            var assertDatabase = await RfidDatabaseAssert.CreateAsync();

            var fRequestModel = Examples.Administrator();
            var sRequestModel = Examples.Administrator("*****@*****.**", "123");

            using (var response = await RfidHttpClient.PostAsync(registerUserSubPath, fRequestModel))
            {
                AssertHttpResponse(response, HttpStatusCode.OK);
            }

            using (var response = await RfidHttpClient.PostAsync(registerUserSubPath, sRequestModel))
            {
                AssertHttpResponse(response, HttpStatusCode.OK);
            }

            await assertDatabase.AssertCntAsync(fRequestModel, sRequestModel);
        }