Пример #1
0
        public void Invoices_get_invoice_notFound()
        {
            var scenario = new DefaultScenario(_logger);

            scenario.GetInvoice();

            var api = new StellarTestApi <object, GetInvoiceResponse>(_logger);

            var url = $"{scenario.BaseUrl}v1/invoices/{Guid.NewGuid()}";

            api
            .SetRequest(null)
            .Execute(api.RestClient.GetAsync <GetInvoiceResponse>, url, scenario.DefaultHeaders)
            .ValidateResponse(IsNotFound);
        }
Пример #2
0
        public void Orders_add_order_success()
        {
            var scenario = new DefaultScenario(_logger);

            scenario.PrepareAddOrderRequest();

            var api = new StellarTestApi <AddOrderRequest, AddOrderResponse>(_logger);

            var url = $"{scenario.BaseUrl}v1/orders/";

            api
            .SetRequest(scenario.AddOrderRequest)
            .Execute(api.RestClient.PostAsync <AddOrderResponse>, url, scenario.DefaultHeaders)
            .ValidateResponse(IsValidResponse);
        }
Пример #3
0
        public void Clients_edit_client_success()
        {
            var scenario = new DefaultScenario(_logger);

            scenario.PrepareEditClientRequest();

            var api = new StellarTestApi <EditClientRequest, EditClientResponse>(_logger);

            var url = $"{scenario.BaseUrl}v1/clients/{scenario.EditClientRequest.Id}";

            api
            .SetRequest(scenario.EditClientRequest)
            .Execute(api.RestClient.PutAsync <EditClientResponse>, url, scenario.DefaultHeaders)
            .ValidateResponse(IsValidResponse);
        }
Пример #4
0
        public void Invoices_get_invoice_unauthorized()
        {
            var scenario = new DefaultScenario(_logger);

            var api = new StellarTestApi <object, GetInvoiceResponse>(_logger);

            scenario.DefaultHeaders["Authorization"] = "not valid token";

            var url = $"{scenario.BaseUrl}v1/invoices/{Guid.NewGuid()}";

            api
            .SetRequest(null)
            .Execute(api.RestClient.GetAsync <GetInvoiceResponse>, url, scenario.DefaultHeaders)
            .ValidateResponse(IsUnauthorized);
        }
Пример #5
0
        public void Orders_delete_order_success()
        {
            var scenario = new DefaultScenario(_logger);

            scenario.AddOrder();

            var api = new StellarTestApi <object, object>(_logger);

            var url = $"{scenario.BaseUrl}v1/orders/{scenario.AddOrderResponse.Result.Id}";

            api
            .SetRequest(null)
            .Execute(api.RestClient.DeleteAsync <object>, url, scenario.DefaultHeaders)
            .ValidateResponse(IsValidResponse);
        }
Пример #6
0
        public void Invoices_get_invoice_success()
        {
            var scenario = new DefaultScenario(_logger);

            scenario.PrepareGetInvoiceRequest();

            var api = new StellarTestApi <GetInvoiceRequest, GetInvoiceResponse>(_logger);

            var url = $"{scenario.BaseUrl}v1/invoices/{scenario.GetInvoiceRequest.Id}";

            api
            .SetRequest(scenario.GetInvoiceRequest)
            .Execute(api.RestClient.GetAsync <GetInvoiceResponse>, url, scenario.DefaultHeaders)
            .ValidateResponse(IsValidResponse);
        }
Пример #7
0
        public void Clients_get_all_clients_success()
        {
            var scenario = new DefaultScenario(_logger, country: ECountry.Norway);

            scenario.AddClient();

            var api = new StellarTestApi <object, GetClientsResponse>(_logger);

            var url = $"{scenario.BaseUrl}v1/clients/";

            api
            .SetRequest(scenario.GetClientRequest)
            .Execute(api.RestClient.GetAsync <GetClientsResponse>, url, scenario.DefaultHeaders)
            .ValidateResponse(IsValidResponse);
        }
Пример #8
0
        public void Orders_get_all_orders_success()
        {
            var scenario = new DefaultScenario(_logger);

            scenario.AddOrder();

            var api = new StellarTestApi <object, GetOrdersResponse>(_logger);

            var url = $"{scenario.BaseUrl}v1/orders/";

            api
            .SetRequest(scenario.GetOrderRequest)
            .Execute(api.RestClient.GetAsync <GetOrdersResponse>, url, scenario.DefaultHeaders)
            .ValidateResponse(IsValidResponse);
        }
Пример #9
0
        public void Invoices_add_invoice_BadRequest_invalid_amount_zero()
        {
            var scenario = new DefaultScenario(_logger);

            scenario.PrepareAddInvoiceRequest();
            scenario.AddInvoiceRequest.Amount = 0;

            var api = new StellarTestApi <AddInvoiceRequest, AddInvoiceResponse>(_logger);

            var url = $"{scenario.BaseUrl}v1/invoices/";

            api
            .SetRequest(scenario.AddInvoiceRequest)
            .Execute(api.RestClient.PostAsync <AddInvoiceResponse>, url, scenario.DefaultHeaders)
            .ValidateResponse(IsBadRequest);
        }
Пример #10
0
        public void Orders_edit_order_BadRequest_invalid_amount_zero()
        {
            var scenario = new DefaultScenario(_logger);

            scenario.PrepareEditOrderRequest();
            scenario.EditOrderRequest.Amount = 0;

            var api = new StellarTestApi <EditOrderRequest, EditOrderResponse>(_logger);

            var url = $"{scenario.BaseUrl}v1/orders/{scenario.EditOrderRequest.Id}";

            api
            .SetRequest(scenario.EditOrderRequest)
            .Execute(api.RestClient.PutAsync <EditOrderResponse>, url, scenario.DefaultHeaders)
            .ValidateResponse(IsBadRequest);
        }
Пример #11
0
        public void AddClient()
        {
            if (AddClientRequest == null)
            {
                PrepareAddClientRequest();
            }

            var api = new StellarTestApi <AddClientRequest, AddClientResponse>(_logger);

            var url = $"{BaseUrl}v1/clients/";

            api
            .SetRequest(AddClientRequest)
            .Execute(api.RestClient.PostAsync <AddClientResponse>, url, DefaultHeaders);

            AddClientResponse = api.Response.Data.Result;
        }
Пример #12
0
        public void GetClient()
        {
            if (GetClientRequest == null)
            {
                PrepareGetClientRequest();
            }

            var api = new StellarTestApi <GetClientRequest, GetClientResponse>(_logger);

            var url = $"{BaseUrl}v1/clients/{GetClientRequest.Id}";

            api
            .SetRequest(null)
            .Execute(api.RestClient.GetAsync <GetClientResponse>, url, DefaultHeaders);

            GetClientResponse = api.Response.Data.Result;
        }
Пример #13
0
        public void EditInvoice()
        {
            if (EditInvoiceRequest == null)
            {
                PrepareEditInvoiceRequest();
            }

            var api = new StellarTestApi <EditInvoiceRequest, EditInvoiceResponse>(_logger);

            var url = $"{BaseUrl}v1/invoices/{EditInvoiceRequest.Id}";

            api
            .SetRequest(EditInvoiceRequest)
            .Execute(api.RestClient.PostAsync <EditInvoiceResponse>, url, DefaultHeaders);

            EditInvoiceResponse = api.Response.Data.Result;
        }
Пример #14
0
        public void GetOrders()
        {
            var api = new StellarTestApi <object, GetOrdersResponse>(_logger);

            var url = $"{BaseUrl}v1/orders/";

            api
            .SetRequest(null)
            .Execute(api.RestClient.GetAsync <GetOrdersResponse>, url, DefaultHeaders);

            GetOrdersResponse = api.Response.Data.Result;

            if (GetOrdersResponse.Result.Count == 0)
            {
                AddOrder();

                GetOrdersResponse.Result.Add(AddOrderResponse.Result);
            }
        }