示例#1
0
        public async Task CreateOrderYesCustomer()
        {
            var entry = new OrderYesCustomerView
            {
                DateCreate = DateTime.Now,
                Email      = "*****@*****.**",
                Items      = new List <OrderItemView>()
            };

            entry.Items.Add(new OrderItemView {
                Flavors = new List <long> {
                    3, 4
                }
            });
            var payload = System.Text.Json.JsonSerializer.Serialize(entry);
            var client  = new SaleProvider()._client;

            var response = await client.PostAsync("/api/v1/Order/new/yes/customer", new StringContent(payload, Encoding.UTF8, "application/json"));

            response.EnsureSuccessStatusCode();
            Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
        }
示例#2
0
        public async Task CreateOrderNoCustomer()
        {
            var entry = new OrderNoCustomerView
            {
                DateCreate   = DateTime.Now,
                Name         = "Ingrid Guimarães Martins Leandro",
                Email        = "*****@*****.**",
                Street       = "Rua Jurupira",
                Number       = "724",
                Complement   = "",
                Neighborhood = "Barra Funda",
                City         = "São Paulo",
                PostalCode   = "02714-000",
                UF           = "SP",
                Items        = new List <OrderItemView>()
            };

            entry.Items.Add(new OrderItemView
            {
                Flavors = new List <long> {
                    3
                },
            });

            entry.Items.Add(new OrderItemView
            {
                Flavors = new List <long> {
                    1, 2
                },
            });
            var payload = System.Text.Json.JsonSerializer.Serialize(entry);
            var client  = new SaleProvider()._client;

            var response = await client.PostAsync("/api/v1/Order/new/no/customer", new StringContent(payload, Encoding.UTF8, "application/json"));

            response.EnsureSuccessStatusCode();
            Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
        }