Esempio n. 1
0
        public void SetUp()
        {
            this.requestResource = new SaHoldStoryResource
            {
                DateFinished           = new DateTime().ToShortDateString(),
                TakenOffHoldByEmployee = "Employee",
                ReasonFinished         = "test"
            };
            var holdStory = new SaHoldStory
            {
                HoldStoryId         = 1,
                DateStarted         = new DateTime(),
                PutOnHoldByEmployee = new Employee {
                    Id = 1, FullName = "Employee"
                },
                ArticleNumber = "KLIMAX/NTK",
                SalesArticle  = new SalesArticle {
                    ArticleNumber = "KLIMAX/NTK"
                },
                ReasonStarted = "reason"
            };

            this.AuthorisationService.HasPermissionFor(AuthorisedAction.ProductHold, Arg.Any <List <string> >()).Returns(true);

            this.SaHoldStoryService.Update(1, Arg.Any <SaHoldStoryResource>())
            .Returns(new SuccessResult <SaHoldStory>(holdStory)
            {
                Data = new SaHoldStory
                {
                    HoldStoryId  = 1,
                    SalesArticle = new SalesArticle {
                        ArticleNumber = "KLIMAX/NTK"
                    },
                    PutOnHoldByEmployee = new Employee {
                        Id = 1, FullName = "Employee"
                    },
                    TakenOffHoldByEmployee = new Employee {
                        Id = 1, FullName = "Employee"
                    },
                    ReasonFinished = "test"
                }
            });

            this.Response = this.Browser.Put(
                "/products/maint/sa-hold-stories/1",
                with =>
            {
                with.Header("Accept", "application/json");
                with.Header("Content-Type", "application/json");
                with.JsonBody(this.requestResource);
            }).Result;
        }
        public void SetUp()
        {
            var saHoldStory1 = new SaHoldStory
            {
                HoldStoryId   = 1,
                ArticleNumber = "AR 1",
                SalesArticle  = new SalesArticle
                {
                    ArticleNumber = "AR 1"
                },
                DateStarted         = DateTime.Today,
                PutOnHoldByEmployee = new Employee
                {
                    Id       = 1234,
                    FullName = "Mr Employee"
                },
                ReasonStarted  = "Reason 1",
                ReasonFinished = "reason2",
                RootProduct    = new RootProduct {
                    Name = "prod"
                }
            };

            var saHoldStory2 = new SaHoldStory
            {
                HoldStoryId   = 2,
                ArticleNumber = "AR 2",
                SalesArticle  = new SalesArticle
                {
                    ArticleNumber = "AR 1"
                },
                DateStarted         = DateTime.Today,
                PutOnHoldByEmployee = new Employee
                {
                    Id       = 1234,
                    FullName = "Mr Employee"
                },
                ReasonStarted = "Reason 2"
            };

            this.SaHoldStoryService.GetAll()
            .Returns(new SuccessResult <IEnumerable <SaHoldStory> >(new List <SaHoldStory> {
                saHoldStory1, saHoldStory2
            }));

            this.Response = this.Browser.Get(
                "/products/maint/sa-hold-stories/",
                with =>
            {
                with.Header("Accept", "application/json");
            }).Result;
        }
Esempio n. 3
0
 public void SetUpContext()
 {
     this.Sut = new SaHoldStory
     {
         HoldStoryId         = 1,
         ReasonStarted       = "test",
         PutOnHoldByEmployee = new Employee {
             Id = 1, FullName = "Employee"
         },
         SalesArticle = new SalesArticle {
             ArticleNumber = "AR"
         }
     };
 }