Exemplo n.º 1
0
        public async Task CreateMarginIssuer()
        {
            MarginIssuerDTO createdIssuer = await this.CreateTestMarginIssuer();

            Assert.NotNull(createdIssuer);

            MarginIssuerEntity entity = await this.MarginIssuerManager.TryGetAsync(createdIssuer.Id) as MarginIssuerEntity;

            entity.ShouldBeEquivalentTo(createdIssuer, o => o
                                        .ExcludingMissingMembers());
        }
Exemplo n.º 2
0
        public async Task DeleteMarginIssuer()
        {
            MarginIssuerDTO TestMarginIssuerDelete = await CreateTestMarginIssuer();

            string url      = ApiPaths.MARGIN_ISSUERS_PATH + "/" + TestMarginIssuerDelete.Id;
            var    response = await this.Consumer.ExecuteRequest(url, Helpers.EmptyDictionary, null, Method.DELETE);

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

            MarginIssuerEntity entity = await this.MarginIssuerManager.TryGetAsync(TestMarginIssuerDelete.Id) as MarginIssuerEntity;

            Assert.Null(entity);
        }
Exemplo n.º 3
0
        public async Task <MarginIssuerDTO> CreateTestMarginIssuer()
        {
            string             url            = ApiPaths.MARGIN_ISSUERS_PATH;
            MarginIssuerEntity templateEntity = EnumerableUtils.PickRandom(AllMarginIssuersFromDB);
            MarginIssuerDTO    createDTO      = this.mapper.Map <MarginIssuerDTO>(templateEntity);

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

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

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

            AddOneTimeCleanupAction(async() => await DeleteTestMarginIssuer(createDTO.Id));

            return(createDTO);
        }
Exemplo n.º 4
0
        public async Task UpdateMarginIssuer()
        {
            string url = ApiPaths.MARGIN_ISSUERS_PATH;

            MarginIssuerDTO TestMarginIssuerUpdate = await CreateTestMarginIssuer();

            MarginIssuerDTO editIssuer = new MarginIssuerDTO()
            {
                Id      = TestMarginIssuerUpdate.Id,
                IconUrl = TestMarginIssuerUpdate.IconUrl + Helpers.Random.Next(1000, 9999).ToString() + GlobalConstants.AutoTest,
                Name    = TestMarginIssuerUpdate.Name + Helpers.Random.Next(1000, 9999).ToString() + GlobalConstants.AutoTest,
            };
            string editParam = JsonUtils.SerializeObject(editIssuer);

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

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

            MarginIssuerEntity entity = await this.MarginIssuerManager.TryGetAsync(TestMarginIssuerUpdate.Id) as MarginIssuerEntity;

            entity.ShouldBeEquivalentTo(editIssuer, o => o
                                        .ExcludingMissingMembers());
        }