Example #1
0
        async void CompletedRegister(object sender, EventArgs e)
        {
            if (await client.UserExists(userId.Text))
            {
                await DisplayAlert("Alert", "The user Id have been taken", "Ok");
            }
            else
            {
                //if(client.UserExists())
                if (userId.Text != "" && fName.Text != "" && lName.Text != "" &&
                    userId.Text != null && fName.Text != null && lName.Text != null)
                {
                    User user = new User
                    {
                        username  = userId.Text,
                        firstName = fName.Text,
                        lastName  = lName.Text,
                        password  = password.Text
                    };

                    await client.RegisterNewTrader(user);
                    await DisplayAlert("Alert", "Sucessful register with user ID" + userId.Text, "Ok");

                    await Navigation.PopAsync();
                }
                else
                {
                    await DisplayAlert("Alert", "Make sure you fill all the box", "Ok");
                }
            }
        }
        public async Task RegisterNewTrader_will_invoke_post()
        {
            await clientWithMock.RegisterNewTrader(user);

            mockBlockService.Verify(m => m.InvokePostAuthentication(FlaskConsts.RegistrationUrl, JsonConvert.SerializeObject(user)));
        }