コード例 #1
0
        public void TestSimpleLoginPostModel2()
        {
            SimpleLoginPostModel model = new SimpleLoginPostModel();

            model.username = "";
            Assert.AreEqual(model.username, "");
        }
コード例 #2
0
        /// <summary>
        /// Attempts the API log in request to log a user into the application
        /// </summary>
        /// <param name="username"></param>
        /// <param name="password"></param>
        /// <returns>
        /// UserLoginInfoModel containing all of the user's info from login
        /// </returns>
        private async Task <UserLoginInfoModel> connectToUserAcct(String username, String password)
        {
            UserLoginInfoModel ret = new UserLoginInfoModel();

            SimpleLoginPostModel loginInfo = new SimpleLoginPostModel();

            loginInfo.username = username;

            if (ApiHelper.ApiClient == null)
            {
                ApiHelper.InitializeClient();
            }

            HttpResponseMessage response =
                await ApiHelper.ApiClient.PostAsJsonAsync("/v1/login", loginInfo);

            if (response.IsSuccessStatusCode)
            {
                var a = response.ToString();

                string content = await response.Content.ReadAsStringAsync();

                ret = JsonConvert.DeserializeObject <UserLoginInfoModel>(content);
            }


            //id (int)
            //username (string)
            //inserted_at (date time)

            return(ret);
        }
コード例 #3
0
        public void TestSimpleLoginPostModel1()
        {
            SimpleLoginPostModel model = new SimpleLoginPostModel();

            Assert.IsNull(model.username);
        }