public async Task RegisterNewProperty_will_invoke_post() { Property property = new Property(); property.PropertyId = "123"; property.description = "456"; await clientWithMock.RegisterNewProperty(property); mockBlockService.Verify(m => m.InvokePost(HyperledgerConsts.PropertyUrl, JsonConvert.SerializeObject(property))); }
async void CreateProperty(object sender, EventArgs e) { BlockchainClient.Result error; Property property = new Property { PropertyId = empty(property_id.Text), description = empty(description.Text), owner = empty(client.thisTrader.traderId) }; using (UserDialogs.Instance.Loading("Creating")) { error = await client.RegisterNewProperty(property); } switch (error) { case BlockchainClient.Result.EMPTY: await DisplayAlert("Alert", "Unsuccessful create: Fields cannot be empty.", "Ok"); break; case BlockchainClient.Result.SUCCESS: await DisplayAlert("Alert", "Sucessful create Asset", "Ok"); break; case BlockchainClient.Result.EXISTERROR: await DisplayAlert("Alert", "Unsucessful create Asset: Asset id already exists", "Ok"); break; case BlockchainClient.Result.NETWORK: await DisplayAlert("Alert", "Error: Network down. Please try again.", "Ok"); break; } await Navigation.PopAsync(); }