Ejemplo n.º 1
0
        public async Task CreateAssetSettings()
        {
            AssetSettingsDTO createdDTO = await this.CreateTestAssetSettings();

            Assert.NotNull(createdDTO);

            AssetSettingsEntity entity = await this.AssetSettingsManager.TryGetAsync(createdDTO.Asset) as AssetSettingsEntity;

            AssetSettingsDTO parsedEntity = this.mapper.Map <AssetSettingsDTO>(entity);

            createdDTO.NormalizeNumberStrings(parsedEntity);

            parsedEntity.ShouldBeEquivalentTo(createdDTO);
        }
Ejemplo n.º 2
0
        public async Task GetSingleAssetSettings()
        {
            string url      = ApiPaths.ASSET_SETTINGS_PATH + "/" + this.TestAssetSettings.Id;
            var    response = await this.Consumer.ExecuteRequest(url, Helpers.EmptyDictionary, null, Method.GET);

            Assert.NotNull(response);
            Assert.True(response.Status == HttpStatusCode.OK);

            AssetSettingsDTO parsedRseponse = JsonUtils.DeserializeJson <AssetSettingsDTO>(response.ResponseJson);
            AssetSettingsDTO parsedEntity   = this.mapper.Map <AssetSettingsDTO>(this.TestAssetSettings);

            parsedRseponse.NormalizeNumberStrings(parsedEntity);

            parsedEntity.ShouldBeEquivalentTo(parsedRseponse);
        }
Ejemplo n.º 3
0
        public async Task GetAllAssetSettings()
        {
            string url      = ApiPaths.ASSET_SETTINGS_PATH;
            var    response = await this.Consumer.ExecuteRequest(url, Helpers.EmptyDictionary, null, Method.GET);

            Assert.NotNull(response);
            Assert.True(response.Status == HttpStatusCode.OK);

            AllAssetSettingsDTO parsedRseponse = JsonUtils.DeserializeJson <AllAssetSettingsDTO>(response.ResponseJson);

            foreach (AssetSettingsEntity entity in this.AllAssetSettingsFromDB)
            {
                AssetSettingsDTO parsedSettings = this.mapper.Map <AssetSettingsDTO>(entity);
                AssetSettingsDTO responseItem   = parsedRseponse.Items.Where(s => s.Id == parsedSettings.Id).FirstOrDefault();
                responseItem.NormalizeNumberStrings(parsedSettings);

                parsedSettings.ShouldBeEquivalentTo(responseItem);
            }
        }
Ejemplo n.º 4
0
        public async Task UpdateAssetSettings()
        {
            string url = ApiPaths.ASSET_SETTINGS_PATH;

            AssetSettingsDTO TestAssetSettingsUpdate = await CreateTestAssetSettings();

            AssetSettingsCreateDTO updateDTO = new AssetSettingsCreateDTO()
            {
                Asset               = TestAssetSettingsUpdate.Asset,
                CashinCoef          = Helpers.Random.Next(1, 10),
                ChangeWallet        = TestAssetSettingsUpdate.ChangeWallet,
                Dust                = Math.Round(Helpers.Random.NextDouble(), 10),
                HotWallet           = TestAssetSettingsUpdate.HotWallet,
                MaxBalance          = Helpers.Random.Next(100, 1000),
                MaxOutputsCount     = Helpers.Random.Next(1, 100),
                MaxOutputsCountInTx = Helpers.Random.Next(1, 100),
                MinBalance          = Helpers.Random.Next(1, 100),
                MinOutputsCount     = Helpers.Random.Next(1, 100),
                OutputSize          = Helpers.Random.Next(100, 10000),
                PrivateIncrement    = 0
            };
            string updateParam = JsonUtils.SerializeObject(updateDTO);

            var response = await this.Consumer.ExecuteRequest(url, Helpers.EmptyDictionary, updateParam, Method.PUT);

            Assert.True(response.Status == HttpStatusCode.NoContent);

            AssetSettingsDTO parsedUpdateDTO = this.mapper.Map <AssetSettingsDTO>(updateDTO);

            AssetSettingsEntity entity = await this.AssetSettingsManager.TryGetAsync(TestAssetSettingsUpdate.Asset) as AssetSettingsEntity;

            AssetSettingsDTO parsedEntity = this.mapper.Map <AssetSettingsDTO>(entity);

            parsedUpdateDTO.NormalizeNumberStrings(parsedEntity);

            parsedEntity.ShouldBeEquivalentTo(parsedUpdateDTO);
        }