public void SetUp() { var requestResource = new WorksOrderResource { PartNumber = "MAJIK", OrderNumber = 12345, CancelledBy = 33067, ReasonCancelled = "REASON" }; var worksOrder = new WorksOrder { PartNumber = "MAJIK", OrderNumber = 12345, CancelledBy = 33067, ReasonCancelled = "REASON", Part = new Part { Description = "DESC" } }; this.WorksOrdersService.UpdateWorksOrder(Arg.Any <WorksOrderResource>()) .Returns(new SuccessResult <WorksOrder>(worksOrder)); this.Response = this.Browser.Put( "/production/works-orders/12345", with => { with.Header("Accept", "application/json"); with.Header("Content-Type", "application/json"); with.JsonBody(requestResource); }).Result; }
public void SetUp() { this.raisedBy = 33067; this.resource = new WorksOrderResource { PartNumber = "MAJIK", RaisedByDepartment = "DEPT", DocType = "DOC", Quantity = 3, KittedShort = "KIT", Links = new[] { new LinkResource("raised-by", $"/employees/{this.raisedBy}") } }; this.worksOrder = new WorksOrder { PartNumber = this.resource.PartNumber, RaisedByDepartment = this.resource.RaisedByDepartment, DocType = this.resource.DocType, RaisedBy = this.raisedBy, Quantity = this.resource.Quantity }; this.WorksOrderFactory.RaiseWorksOrder(Arg.Any <WorksOrder>()) .Returns(this.worksOrder); this.result = this.Sut.AddWorksOrder(this.resource); }
public void SetUp() { var requestResource = new WorksOrderResource { PartNumber = "MAJIK", OrderNumber = 12345, }; var worksOrder = new WorksOrder { PartNumber = "MAJIK", OrderNumber = 12345, Part = new Part { Description = "DESC" } }; this.WorksOrdersService.AddWorksOrder(Arg.Any <WorksOrderResource>()) .Returns(new CreatedResult <WorksOrder>(worksOrder)); this.Response = this.Browser.Post( "/production/works-orders", with => { with.Header("Accept", "application/json"); with.Header("Content-Type", "application/json"); with.JsonBody(requestResource); }).Result; }
public void SetUp() { this.raisedBy = 33067; this.resource = new WorksOrderResource { PartNumber = "MAJIK", RaisedByDepartment = "DEPT", DocType = "DOC", RaisedBy = 33067, Quantity = 3, Links = new[] { new LinkResource("raised-by", $"/employees/{this.raisedBy}") } }; this.worksOrder = new WorksOrder { PartNumber = this.resource.PartNumber, RaisedByDepartment = this.resource.RaisedByDepartment, DocType = this.resource.DocType, RaisedBy = this.resource.RaisedBy, Quantity = this.resource.Quantity }; this.WorksOrderFactory.RaiseWorksOrder(Arg.Any <WorksOrder>()) .Throws(new DomainException("Exception")); this.result = this.Sut.AddWorksOrder(this.resource); }
public void SetUp() { this.resource = new WorksOrderResource { OrderNumber = 1234, Links = new[] { new LinkResource("updated-by", $"/employees/33067") } }; this.WorksOrderRepository.FindById(this.resource.OrderNumber).Returns((WorksOrder)null); this.result = this.Sut.UpdateWorksOrder(this.resource); }
public void SetUp() { this.updatedBy = 33067; this.resource = new WorksOrderResource { OrderNumber = 1234, Quantity = 6, Links = new[] { new LinkResource("updated-by", $"/employees/{this.updatedBy}") } }; this.worksOrder = new WorksOrder { OrderNumber = 1234, PartNumber = "MAJIK" }; this.WorksOrderRepository.FindById(this.resource.OrderNumber).Returns(this.worksOrder); this.result = this.Sut.UpdateWorksOrder(this.resource); }