Esempio n. 1
0
        //[Fact]
        public async Task Should_Return_OK_When_DeleteAsync()
        {
            HttpClientFactory client = new HttpClientFactory(MockStartup <Startup> .Instance.GetCliente());
            await client.AddAuthorizationAsync();

            var entity = new OrderDTO()
            {
                Date         = DateTime.Now,
                ExchangeId   = Guid.NewGuid(),
                BaseAssetId  = Guid.NewGuid(),
                QuoteAssetId = Guid.NewGuid(),
                OrderItems   = new List <OrderItemDTO>()
                {
                    new OrderItemDTO()
                    {
                        Price      = 1,
                        Quantity   = 1,
                        Fee        = 1,
                        FeeAssetId = Guid.NewGuid()
                    }
                }
            };
            var result = await client.PostAsync(ROUTE_PATH, entity);

            Assert.Equal(HttpStatusCode.OK, result.StatusCode);
            entity = JsonConvert.DeserializeObject <OrderDTO>(await result.Content.ReadAsStringAsync());
            result = await client.DeleteAsync($"{ROUTE_PATH}/{entity.Id}");

            Assert.Equal(HttpStatusCode.OK, result.StatusCode);
        }
Esempio n. 2
0
        //[Fact]
        public async Task Should_Return_OK_When_Get_By_User_Async()
        {
            var client = new HttpClientFactory(MockStartup <Startup> .Instance.GetCliente());
            await client.AddAuthorizationAsync();

            var entity = new OrderDTO()
            {
                Date         = DateTime.Now,
                ExchangeId   = Guid.NewGuid(),
                BaseAssetId  = Guid.NewGuid(),
                QuoteAssetId = Guid.NewGuid(),
                OrderItems   = new List <OrderItemDTO>()
                {
                    new OrderItemDTO()
                    {
                        Price      = 1,
                        Quantity   = 1,
                        Fee        = 1,
                        FeeAssetId = Guid.NewGuid()
                    }
                }
            };
            var result = await client.PostAsync(ROUTE_PATH, entity);

            Assert.Equal(HttpStatusCode.OK, result.StatusCode);

            client = new HttpClientFactory(MockStartup <Startup> .Instance.GetCliente());
            await client.AddAuthorizationAsync();

            result = await client.GetAsync($"{ROUTE_PATH}/GetOrderDetailsByApplicationUser");

            Assert.Equal(HttpStatusCode.OK, result.StatusCode);
        }
        //[Fact]
        public async Task Should_Return_User_Info_When_AccessToken_IsValid()
        {
            HttpClientFactory client = new HttpClientFactory(MockStartup <Startup> .Instance.GetCliente());
            await client.AddAuthorizationAsync();

            var result = await client.GetAsync(ROUTE_PATH);

            Assert.Equal(HttpStatusCode.OK, result.StatusCode);
        }
Esempio n. 4
0
        //[Fact]
        public async Task Should_Return_NotFound_When_Not_Exist_In_DeleteAsync()
        {
            HttpClientFactory client = new HttpClientFactory(MockStartup <Startup> .Instance.GetCliente());
            await client.AddAuthorizationAsync();

            var id     = new Guid();
            var result = await client.DeleteAsync($"{ROUTE_PATH}/{id}");

            Assert.Equal(HttpStatusCode.NotFound, result.StatusCode);
        }
Esempio n. 5
0
        //[Fact]
        public async Task Should_Return_OK_When_PostAsync()
        {
            HttpClientFactory client = new HttpClientFactory(MockStartup <Startup> .Instance.GetCliente());
            await client.AddAuthorizationAsync();

            var entity = new AssetDTO()
            {
                Name        = "Teste",
                Description = "teste",
                Symbol      = "T"
            };
            var result = await client.PostAsync(ROUTE_PATH, entity);

            Assert.Equal(HttpStatusCode.OK, result.StatusCode);
        }
        //[Fact]
        public async Task Should_Return_OK_When_PostAsync()
        {
            HttpClientFactory client = new HttpClientFactory(MockStartup <Startup> .Instance.GetCliente());
            await client.AddAuthorizationAsync();

            var entity = new ExchangeDTO()
            {
                Name    = "Teste",
                APIUrl  = "api",
                Website = "website"
            };
            var result = await client.PostAsync(ROUTE_PATH, entity);

            Assert.Equal(HttpStatusCode.OK, result.StatusCode);
        }
Esempio n. 7
0
        //[Fact]
        public async Task Should_Return_OK_When_DeleteAsync()
        {
            HttpClientFactory client = new HttpClientFactory(MockStartup <Startup> .Instance.GetCliente());
            await client.AddAuthorizationAsync();

            var entity = new AssetDTO()
            {
                Name        = "Teste",
                Description = "teste",
                Symbol      = "T"
            };
            var result = await client.PostAsync(ROUTE_PATH, entity);

            Assert.Equal(HttpStatusCode.OK, result.StatusCode);
            entity = JsonConvert.DeserializeObject <AssetDTO>(await result.Content.ReadAsStringAsync());
            result = await client.DeleteAsync($"{ROUTE_PATH}/{entity.Id}");

            Assert.Equal(HttpStatusCode.OK, result.StatusCode);
        }
        //[Fact]
        public async Task Should_Return_OK_When_GetByIdAsync()
        {
            HttpClientFactory client = new HttpClientFactory(MockStartup <Startup> .Instance.GetCliente());
            await client.AddAuthorizationAsync();

            var entity = new ExchangeDTO()
            {
                Name    = "Teste",
                APIUrl  = "api",
                Website = "website"
            };
            var result = await client.PostAsync(ROUTE_PATH, entity);

            Assert.Equal(HttpStatusCode.OK, result.StatusCode);
            entity = JsonConvert.DeserializeObject <ExchangeDTO>(await result.Content.ReadAsStringAsync());
            result = await client.GetAsync($"{ROUTE_PATH}/{entity.Id}");

            Assert.Equal(HttpStatusCode.OK, result.StatusCode);
        }