Beispiel #1
0
        public async Task TestOffersExecute()
        {
            var jsonResponse   = File.ReadAllText(Path.Combine("testdata", "offerPage.json"));
            var fakeHttpClient = FakeHttpClient.CreateFakeHttpClient(jsonResponse);

            using (var server = new Server("https://horizon-testnet.stellar.org", fakeHttpClient))
            {
                var offerResponsePage = await server.Offers.ForAccount(KeyPair.FromAccountId("GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7"))
                                        .Execute();

                OfferPageDeserializerTest.AssertTestData(offerResponsePage);
            }
        }
Beispiel #2
0
        public async Task TestOffersWithSeller()
        {
            var jsonResponse   = File.ReadAllText(Path.Combine("testdata", "offerPage.json"));
            var fakeHttpClient = FakeHttpClient.CreateFakeHttpClient(jsonResponse);

            using (var server = new Server("https://horizon-testnet.stellar.org", fakeHttpClient))
            {
                var req = server.Offers.WithSeller("GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7");

                Assert.AreEqual("https://horizon-testnet.stellar.org/offers?seller=GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7", req.BuildUri().ToString());

                var offerResponsePage = await req.Execute();

                OfferPageDeserializerTest.AssertTestData(offerResponsePage);
            }
        }
Beispiel #3
0
        public async Task TestOffersWithSellingNativeAsset()
        {
            var jsonResponse   = File.ReadAllText(Path.Combine("testdata", "offerPage.json"));
            var fakeHttpClient = FakeHttpClient.CreateFakeHttpClient(jsonResponse);

            using (var server = new Server("https://horizon-testnet.stellar.org", fakeHttpClient))
            {
                var req = server.Offers.WithSellingAsset(new AssetTypeNative());

                Assert.AreEqual(
                    "https://horizon-testnet.stellar.org/offers?selling_asset_type=native",
                    req.BuildUri().ToString());

                var offerResponsePage = await req.Execute();

                OfferPageDeserializerTest.AssertTestData(offerResponsePage);
            }
        }
Beispiel #4
0
        public async Task TestOffersWithBuyingCreditAsset()
        {
            var jsonResponse   = File.ReadAllText(Path.Combine("testdata", "offerPage.json"));
            var fakeHttpClient = FakeHttpClient.CreateFakeHttpClient(jsonResponse);

            using (var server = new Server("https://horizon-testnet.stellar.org", fakeHttpClient))
            {
                var notNativeAsset = Asset.CreateNonNativeAsset("FOOBARBAZ",
                                                                "GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7");
                var req = server.Offers.WithBuyingAsset(notNativeAsset);

                Assert.AreEqual(
                    "https://horizon-testnet.stellar.org/offers?buying_asset_type=credit_alphanum12&buying_asset_code=FOOBARBAZ&buying_asset_issuer=GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7",
                    req.BuildUri().ToString());

                var offerResponsePage = await req.Execute();

                OfferPageDeserializerTest.AssertTestData(offerResponsePage);
            }
        }