Пример #1
0
        public async Task CanRequestSignIn()
        {
            await _walletAccount.RequestSignIn("signInContract", "signInTitle", new Uri("http://example.com/success"), new Uri("http://example.com/fail"), new Uri("http://example.com/location"));

            var accounts = await _keyStore.GetAccountsAsync("networkId");

            Assert.AreEqual(1, accounts.Length);
            Assert.IsTrue(accounts[0].Contains("pending_key"));

            var expected = new UriBuilder("http://example.com/");
            var keyPair  = await _keyStore.GetKeyAsync("networkId", accounts[0]);

            var publicKey = keyPair.GetPublicKey().ToString();

            expected.Query = new FormUrlEncodedContent(new Dictionary <string, string>()
            {
                { "title", "signInTitle" },
                { "contract_id", "signInContract" },
                { "success_url", "http://example.com/success" },
                { "failure_url", "http://example.com/fail" },
                { "app_url", "http://example.com/location" },
                { "public_key", publicKey },
            }).ReadAsStringAsync().Result;

            var actual = new Uri(_authService.Urls[0]);

            Assert.AreEqual(expected.Uri.Query, actual.Query);
            Assert.AreEqual(expected.Uri.Host, actual.Host);
        }