예제 #1
0
        public async Task UpdateAssetExtendedInfo()
        {
            string url = ApiPaths.ASSET_EXTENDED_INFO_PATH;
            AssetExtendedInfoDTO TestAssetExtendedInfoUpdate = await CreateTestAssetExtendedInfo();

            AssetExtendedInfoDTO updateExtendedInfo = new AssetExtendedInfoDTO()
            {
                Id                   = TestAssetExtendedInfoUpdate.Id,
                AssetClass           = TestAssetExtendedInfoUpdate.AssetClass,
                AssetDescriptionUrl  = TestAssetExtendedInfoUpdate.AssetDescriptionUrl,
                Description          = TestAssetExtendedInfoUpdate.Description,
                FullName             = TestAssetExtendedInfoUpdate.FullName + "_autotestt",
                MarketCapitalization = TestAssetExtendedInfoUpdate.MarketCapitalization,
                NumberOfCoins        = TestAssetExtendedInfoUpdate.NumberOfCoins,
                PopIndex             = TestAssetExtendedInfoUpdate.PopIndex
            };
            string updateParam = JsonUtils.SerializeObject(updateExtendedInfo);

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

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

            AssetExtendedInfosEntity checkDbUpdated = (AssetExtendedInfosEntity)await this.AssetExtendedInfosManager.TryGetAsync(TestAssetExtendedInfoUpdate.Id);

            checkDbUpdated.ShouldBeEquivalentTo(updateParam, o => o
                                                .ExcludingMissingMembers());
        }
예제 #2
0
        public async Task CreateAssetExtendedInfo()
        {
            AssetExtendedInfoDTO createdInfo = await this.CreateTestAssetExtendedInfo();

            Assert.NotNull(createdInfo);

            AssetExtendedInfosEntity checkDbCreated = (AssetExtendedInfosEntity)await this.AssetExtendedInfosManager.TryGetAsync(createdInfo.Id);

            checkDbCreated.ShouldBeEquivalentTo(createdInfo, o => o
                                                .ExcludingMissingMembers());
        }
예제 #3
0
        public async Task DeleteAssetExtendedInfo()
        {
            AssetExtendedInfoDTO TestAssetExtendedInfoDelete = await CreateTestAssetExtendedInfo();

            string deleteUrl      = ApiPaths.ASSET_EXTENDED_INFO_PATH + "/" + TestAssetExtendedInfoDelete.Id;
            var    deleteResponse = await this.Consumer.ExecuteRequest(deleteUrl, Helpers.EmptyDictionary, null, Method.DELETE);

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

            AssetExtendedInfosEntity checkDbDeleted = (AssetExtendedInfosEntity)await this.AssetExtendedInfosManager.TryGetAsync(TestAssetExtendedInfoDelete.Id);

            Assert.Null(checkDbDeleted);
        }
예제 #4
0
        public async Task GetSingleAssetExtendedInfo()
        {
            string url      = ApiPaths.ASSET_EXTENDED_INFO_PATH + "/" + this.TestAssetExtendedInfo.Id;
            var    response = await this.Consumer.ExecuteRequest(url, Helpers.EmptyDictionary, null, Method.GET);

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

            AssetExtendedInfoDTO parsedResponse = JsonUtils.DeserializeJson <AssetExtendedInfoDTO>(response.ResponseJson);

            Assert.NotNull(parsedResponse);

            this.TestAssetExtendedInfo.ShouldBeEquivalentTo(parsedResponse, o => o
                                                            .ExcludingMissingMembers());
        }
예제 #5
0
        public async Task <AssetExtendedInfoDTO> CreateTestAssetExtendedInfo(bool deleteWithDispose = true)
        {
            string url = ApiPaths.ASSET_EXTENDED_INFO_PATH;

            AssetExtendedInfoDTO newExtendedInfo = this.mapper.Map <AssetExtendedInfoDTO>(EnumerableUtils.PickRandom(AllAssetExtendedInfosFromDB));

            newExtendedInfo.Id       += Helpers.Random.Next(1000, 9999).ToString() + GlobalConstants.AutoTest;
            newExtendedInfo.FullName += Helpers.Random.Next(1000, 9999).ToString() + GlobalConstants.AutoTest;
            string createParam = JsonUtils.SerializeObject(newExtendedInfo);

            var response = await Consumer.ExecuteRequest(url, Helpers.EmptyDictionary, createParam, Method.POST);

            if (response.Status != HttpStatusCode.Created)
            {
                return(null);
            }

            AddOneTimeCleanupAction(async() => await DeleteTestAssetExtendedInfo(newExtendedInfo.Id));

            return(newExtendedInfo);
        }