Beispiel #1
0
        public async Task SetBaseAsset()
        {
            Logger.WriteLine("This test fails due to a Typo in POST /api/assets/baseAsset BaseAsssetId -> BaseAssetId");

            string       url      = ApiPaths.ASSETS_BASEASSET_PATH;
            string       testID   = "LKK_TEST";
            BaseAssetDTO body     = new BaseAssetDTO(testID);
            var          response = await this.Consumer.ExecuteRequest(url, Helpers.EmptyDictionary, JsonUtils.SerializeObject(body), Method.POST);

            Assert.True(response.Status == HttpStatusCode.OK);
            string newBaseAssetId = JsonUtils.DeserializeJson <string>(response.ResponseJson);

            //check if the ID has changed
            Assert.Null(newBaseAssetId);
            Assert.True(newBaseAssetId == testID);
        }
        private async Task PrepareTestData()
        {
            var TestClient = await Consumer.RegisterNewUser();

            TestClientId = TestClient.Account.Id;
            var walletsFromDB    = this.WalletRepository.GetAllAsync(w => w.ClientId == TestClientId && w.State != "deleted");
            var operationsFromDB = this.OperationsRepository.GetAllAsync(o => o.PartitionKey == OperationsEntity.GeneratePartitionKey() && o.ClientId.ToString() == TestClientId);

            this.TestAssetId      = Constants.TestAssetId;
            this.AssetPrecission  = 2;
            this.AllWalletsFromDb = (await walletsFromDB).Cast <WalletEntity>().ToList();
            this.TestWallet       = await CreateTestWallet();

            //fill wallet with funds
            await MEConsumer.Client.UpdateBalanceAsync(Guid.NewGuid().ToString(), TestWallet.Id, Constants.TestAssetId, 50.0);

            this.TestWalletWithBalanceId = TestWallet.Id;


            this.TestWalletDelete = await CreateTestWallet();

            this.TestWalletAccount = await AccountRepository.TryGetAsync(TestWallet.Id) as AccountEntity;

            this.TestWalletOperations = await CreateTestWallet();

            this.TestWalletRegenerateKey = await CreateTestWallet(true);

            this.TestOperation = await CreateTestOperation();

            this.TestOperationCancel = await CreateTestOperation();

            this.TestOperationCreateDetails = await CreateTestOperation();

            this.TestOperationRegisterDetails = await CreateTestOperation();


            this.ClientInfoConsumer = new ApiConsumer(_apiV2Settings);
            await this.ClientInfoConsumer.RegisterNewUser();

            AddOneTimeCleanupAction(async() => await ClientAccounts.DeleteClientAccount(ClientInfoConsumer.ClientInfo.Account.Id));

            // set the id to the default one in case it has been changed by any test
            BaseAssetDTO body     = new BaseAssetDTO(this.TestAssetId);
            var          response = await Consumer.ExecuteRequest(ApiPaths.ASSETS_BASEASSET_PATH, Helpers.EmptyDictionary, JsonUtils.SerializeObject(body), Method.POST);
        }