コード例 #1
0
        public async void testAuthenticateNullValue()
        {
            //Arrange
            string username            = "";
            string password            = "";
            bool   expectAuthenticated = false;

            //Act
            AuthenticateJsonResult result = await MyMartService.AuthenWithUsername(username, password);

            //Assert
            Assert.IsTrue(result.Authenticated == expectAuthenticated);
        }
コード例 #2
0
        public async void testAuthenticateSucess()
        {
            //Arrange
            string username     = "******";
            string password     = "******";
            string expectUserID = "bc9ce5ff-1731-457f-bee3-336a99165c22";

            //Act
            AuthenticateJsonResult result = await MyMartService.AuthenWithUsername(username, password);

            //Assert
            Assert.IsTrue(result.UserID == expectUserID);
        }
コード例 #3
0
        public async void testAuthenticateFail()
        {
            //Arrange
            string username            = "******";
            string password            = "******";
            bool   expectAuthenticated = false;

            //Act
            AuthenticateJsonResult result = await MyMartService.AuthenWithUsername(username, password);

            //Assert
            Assert.IsTrue(result.Authenticated == expectAuthenticated);
        }
コード例 #4
0
        private async void loginButton_Click(object sender, RoutedEventArgs e)
        {
            AuthenticateJsonResult result = await MyMartService.AuthenWithUsername(userNameTextBox.Text, passwordBox.Password);

            if (result.Authenticated)
            {
                LocalSetting.UserID = result.UserID;
                LoggedIn(sender, e);
            }
            else
            {
                MessageDialog messageDialog = new MessageDialog(result.ExceptionMessage, "Authentication Fail");
                await messageDialog.ShowAsync();
            }
        }