public void SetUp() { this.EmployeeRepository.FindById(1).Returns(new Employee { Id = 1, FullName = "Colin" }); this.DbService.GetNextVal(Arg.Any <string>()).Returns(1); this.resource = new PartFailResource { Id = 1, WorksOrderNumber = 1, PartNumber = "PART", Batch = "BATCH", EnteredBy = 1, EnteredByName = "Colin", DateCreated = new DateTime().ToString("o"), ErrorType = "Error", FaultCode = "Fault", SerialNumber = 101 }; this.PartFailService.Create(Arg.Any <PartFail>()) .Returns(new PartFail { Id = 1 }); this.result = this.Sut.Add(this.resource); }
public void SetUp() { this.EmployeeRepository.FindById(1).Returns(new Employee { Id = 1, FullName = "Colin" }); var partFail = new PartFail { Id = 1, Part = new Part { PartNumber = "PART" }, Batch = "BATCH", EnteredBy = new Employee { Id = 1, FullName = "Colin" }, DateCreated = new DateTime(), ErrorType = new PartFailErrorType(), FaultCode = new PartFailFaultCode() }; this.resource = new PartFailResource { Id = 1324, WorksOrderNumber = 1, PartNumber = "PART", Batch = "NEW BATCH", EnteredBy = 1, EnteredByName = "Colin", DateCreated = new DateTime().ToString("o"), ErrorType = "Error", FaultCode = "Fault", SerialNumber = 202 }; this.PartFailService.Create(Arg.Any <PartFail>()) .Returns(new PartFail { Id = 1, Part = new Part { PartNumber = "PART" }, Batch = "NEW BATCH", EnteredBy = new Employee { Id = 1, FullName = "Colin" }, DateCreated = new DateTime(), ErrorType = new PartFailErrorType(), FaultCode = new PartFailFaultCode() }); this.PartFailRepository.FindById(1).Returns(partFail); this.result = this.Sut.Update(1, this.resource); }
public void SetUp() { this.requestResource = new PartFailResource { WorksOrderNumber = 99999999, EnteredBy = 12345678, EnteredByName = "Colin", PartNumber = "PART", PartDescription = "Something" }; var partFail = new PartFail { Id = 1, WorksOrder = new WorksOrder { OrderNumber = 1, PartNumber = "A", Part = new Part { Description = "desc" } }, EnteredBy = new Employee { Id = 1, FullName = "name" }, Part = new Part { PartNumber = "A", Description = "B" }, StorageLocation = new StorageLocation { LocationId = 1, LocationCode = "LOC" }, ErrorType = new PartFailErrorType { ErrorType = "Error", DateInvalid = null }, FaultCode = new PartFailFaultCode { FaultCode = "F", Description = "Fault" } }; this.FacadeService.Add(Arg.Any <PartFailResource>()) .Returns(new CreatedResult <PartFail>(partFail)); this.Response = this.Browser.Post( "/production/quality/part-fails", with => { with.Header("Accept", "application/json"); with.Header("Content-Type", "application/json"); with.JsonBody(this.requestResource); }).Result; }
public void SetUp() { var a = new PartFail { Id = 1, WorksOrder = new WorksOrder { OrderNumber = 1, PartNumber = "A", Part = new Part { Description = "desc" } }, EnteredBy = new Employee { Id = 1, FullName = "name" }, Part = new Part { PartNumber = "A", Description = "B" }, StorageLocation = new StorageLocation { LocationId = 1, LocationCode = "LOC" }, ErrorType = new PartFailErrorType { ErrorType = "Error", DateInvalid = null }, FaultCode = new PartFailFaultCode { FaultCode = "F", Description = "Fault" } }; this.requestResource = new PartFailResource() { Id = 1, WorksOrderNumber = 1, PartNumber = "A", EnteredBy = 1 }; this.FacadeService.Update(1, Arg.Any <PartFailResource>()).Returns(new SuccessResult <PartFail>(a)); this.Response = this.Browser.Put( "/production/quality/part-fails/1", with => { with.Header("Accept", "application/json"); with.JsonBody(this.requestResource); }).Result; }