public async Task WorkFlowTests() { //Arrange CREATE var orderModel = _fixture.Create <OrderModel>(); var createdId = orderModel.Id; //Act CREATE var retrunModel = await _client.CreateOrder(orderModel); //Assert CREATE Assert.AreNotEqual(createdId, retrunModel.Id); //Act GET var order = await _client.GetOrder(retrunModel.Id); //Assert GET Assert.AreNotEqual(retrunModel, order); //Arrange UPDATE var oldName = order.CustomerName; order.CustomerName = Guid.NewGuid().ToString(); //Act UPDATE await _client.UpdateOrder(order); order = await _client.GetOrder(order.Id); //Assert UPDATE Assert.AreNotEqual(oldName, order.CustomerName); //Act DELETE await _client.DeleteOrder(order.Id); order = await _client.GetOrder(order.Id); //Assert DELETE Assert.IsNull(order); }
public void PlaceOrder_GivenANewOrder_ProcessesAndPlacesTheOrder() { // arrange Order order = CreateOrder(); PaymentInfo payment = CreatePayment(); ShippingInfo shipping = CreateShipping(); // act var actualResult = orderClient.PlaceOrder(order, shipping, payment); // assert Assert.IsTrue(actualResult); // since this is the only order record in the database, its order ID is 1 var actualOrder = orderClient.GetOrder(1); Assert.IsTrue(actualOrder.HasProcessed); var actualItems = new List <OrderItem>(actualOrder.Items); Assert.AreEqual(3, actualItems.Count); }