public void GetLineItemsBeforePostReturnsNotFound() { var controller = new LineItemsController(); ControllerSetup.RegisterContext(controller, "LineItems"); var result = controller.Get(); Assert.Equal(HttpStatusCode.NotFound, result.Result.StatusCode); }
public void PostLineItemReturnsValidLineItem() { var controller = new LineItemsController(); ControllerSetup.RegisterContext(controller, "LineItems"); var lineitem = new LineItem { LineItemOf = new Context { ContextId = LineItemsController.ContextId }, ReportingMethod = "res:Result" }; var result = controller.Post(lineitem); Assert.Equal(HttpStatusCode.Created, result.Result.StatusCode); var lineItem = JsonConvert.DeserializeObject<LineItem>(result.Result.Content.ReadAsStringAsync().Result); Assert.NotNull(lineItem); Assert.Equal(LineItemsController.LineItemId, lineItem.Id.ToString()); }
public void PostLineItemReturnsValidLineItem() { var controller = new LineItemsController(); ControllerSetup.RegisterContext(controller, "LineItems"); var lineitem = new LineItem { LineItemOf = new Context { ContextId = LineItemsController.ContextId }, ReportingMethod = "res:Result" }; var result = controller.Post(LineItemsController.ContextId, lineitem); Assert.Equal(HttpStatusCode.Created, result.Result.StatusCode); var lineItem = JsonConvert.DeserializeObject <LineItem>(result.Result.Content.ReadAsStringAsync().Result); Assert.NotNull(lineItem); Assert.Equal(LineItemsController.LineItemId, lineItem.Id.ToString()); }