public void SetUp()
        {
            this.requestResource = new MechPartSourceResource
            {
                Id              = 1,
                ProposedBy      = 33087,
                AssemblyType    = "SM",
                SamplesRequired = "N"
            };

            var source = new MechPartSource
            {
                Id         = 1,
                ProposedBy = new Employee {
                    Id = 33087
                },
                AssemblyType    = "SM",
                SamplesRequired = "N"
            };

            this.MechPartSourceService.Add(Arg.Any <MechPartSourceResource>())
            .Returns(new CreatedResult <MechPartSource>(source));
            this.AuthService.HasPermissionFor(Arg.Any <string>(), Arg.Any <IEnumerable <string> >()).Returns(false);

            this.Response = this.Browser.Post(
                "/inventory/parts/sources",
                with =>
            {
                with.Header("Accept", "application/json");
                with.Header("Content-Type", "application/json");
                with.JsonBody(this.requestResource);
            }).Result;
        }
 public void SetUp()
 {
     this.candidate = new MechPartSource
                          {
                              SafetyCritical = "Y"
                          };
 }
Пример #3
0
        public void SetUp()
        {
            this.candidate = new MechPartSource
            {
                Id                     = 1,
                SafetyCritical         = "Y",
                SafetyDataDirectory    = "/path",
                MechanicalOrElectrical = "M",
            };

            this.result = this.Sut.Create(this.candidate, new List <PartDataSheet>());
        }
Пример #4
0
        public void SetUp()
        {
            this.requestResource = new MechPartSourceResource
            {
                Id              = 1,
                ProposedBy      = 33087,
                AssemblyType    = "SM",
                SamplesRequired = "N",
                CreatePart      = true
            };

            var source = new MechPartSource
            {
                Id         = 1,
                ProposedBy = new Employee {
                    Id = 33087
                },
                AssemblyType    = "SM",
                SamplesRequired = "N"
            };

            var part = new Part
            {
                Id = 1,
                StockControlled = "Y",
                CreatedBy       = new Employee {
                    Id = 33087
                },
            };

            this.MechPartSourceService.Add(Arg.Any <MechPartSourceResource>())
            .Returns(new CreatedResult <MechPartSource>(source));
            this.PartsDomainService.CreateFromSource(1, 33087, new List <PartDataSheet>()).Returns(part);
            this.MechPartSourceService.GetById(1).Returns(new SuccessResult <MechPartSource>(source));
            this.AuthService.HasPermissionFor(
                Arg.Any <string>(),
                Arg.Any <IEnumerable <string> >()).Returns(true);

            this.Response = this.Browser.Post(
                "/inventory/parts/sources",
                with =>
            {
                with.Header("Accept", "application/json");
                with.Header("Content-Type", "application/json");
                with.JsonBody(this.requestResource);
            }).Result;
        }
Пример #5
0
        public void SetUp()
        {
            this.requestResource = new MechPartSourceResource
            {
                Id          = 1,
                DateEntered = DateTime.Today.ToString("o"),
                Part        = new PartResource
                {
                    PartNumber      = "PART",
                    Id              = 1,
                    Description     = "Desc",
                    StockControlled = "Y",
                    CreatedBy       = 1
                },
            };

            var p = new MechPartSource
            {
                Id   = 1,
                Part = new Part
                {
                    Id = 1,
                    StockControlled = "Y",
                    CreatedBy       = new Employee {
                        Id = 1
                    }
                },
                DateEntered = DateTime.Today
            };

            this.MechPartSourceService.Update(1, Arg.Any <MechPartSourceResource>())
            .Returns(new SuccessResult <MechPartSource>(p));
            this.AuthService.HasPermissionFor(Arg.Any <string>(), Arg.Any <IEnumerable <string> >()).Returns(false);
            this.Response = this.Browser.Put(
                "inventory/parts/sources/1",
                with =>
            {
                with.Header("Accept", "application/json");
                with.Header("Content-Type", "application/json");
                with.JsonBody(this.requestResource);
            }).Result;
        }
Пример #6
0
        public void SetUp()
        {
            var p = new MechPartSource
            {
                Id   = 1,
                Part = new Part
                {
                    Id = 1, StockControlled = "Y", CreatedBy = new Employee {
                        Id = 1
                    }
                },
                DateEntered = DateTime.Today
            };

            this.MechPartSourceService.GetById(1).Returns(new SuccessResult <MechPartSource>(p));

            this.Response = this.Browser.Get(
                "inventory/parts/sources/1",
                with => { with.Header("Accept", "application/json"); }).Result;
        }
Пример #7
0
        public void SetUp()
        {
            var employee = new Employee {
                Id = 33870
            };
            var dataSheets = new List <PartDataSheet>
            {
                new PartDataSheet
                {
                    Sequence    = 1,
                    PdfFilePath = "/path/1"
                },
            };
            var part = new Part {
                Id = 12, PartNumber = "PART 012", DataSheets = dataSheets,
            };

            var mechPartSource = new MechPartSource
            {
                Id = 1,
                DateSamplesRequired = DateTime.Today,
                ProposedBy          = employee,
                ProductionDate      = DateTime.Today,
                LinnPartNumber      = "PART 123",
                Part = part,
            };

            var dataSheetsResource = new List <PartDataSheetResource>
            {
                new PartDataSheetResource
                {
                    Sequence    = 1,
                    PdfFilePath = "/path/1"
                },
                new PartDataSheetResource
                {
                    Sequence    = 2,
                    PdfFilePath = "/path/2"
                },
            };

            var mechPartAltsResource = new List <MechPartAltResource>
            {
                new MechPartAltResource
                {
                    PartNumber   = "PART 012",
                    Sequence     = 1,
                    SupplierId   = 1,
                    SupplierName = "SUP"
                }
            };

            var mechPartManufacturerAlts = new List <MechPartManufacturerAltResource>
            {
                new MechPartManufacturerAltResource
                {
                    PartNumber       = "PART 012",
                    Sequence         = 1,
                    ManufacturerCode = "M"
                }
            };

            this.resource = new MechPartSourceResource
            {
                Id = 1,
                DateSamplesRequired = DateTime.Today.ToString("o"),
                ProposedBy          = 33870,
                ProductionDate      = DateTime.Today.ToString("o"),
                LinnPartNumber      = "PART 123",
                MechPartAlts        = mechPartAltsResource,
                Part = new PartResource
                {
                    PartNumber = "PART 012",
                    DataSheets = dataSheetsResource,
                },
                MechPartManufacturerAlts = mechPartManufacturerAlts
            };
            this.PartRepository.FindById(12).Returns(part);
            this.EmployeeRepository.FindById(33870).Returns(employee);
            this.SupplierRepository.FindBy(Arg.Any <Expression <Func <Supplier, bool> > >())
            .Returns(new Supplier {
                Id = 1
            });
            this.MechPartSourceRepository.FindById(1).Returns(mechPartSource);
            this.result = this.Sut.Update(this.resource.Id, this.resource);
        }