Example #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()
        {
            this.requestResource = new SaHoldStoryResource
            {
                DateFinished           = new DateTime().ToShortDateString(),
                TakenOffHoldByEmployee = "Employee",
                ReasonFinished         = "test"
            };

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

            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 links = new[] { new LinkResource("put-on-hold-by", "/employees/1") };

            this.SalesArticleRepository.FindById("AR").Returns(new SalesArticle {
                ArticleNumber = "AR"
            });
            this.EmployeeRepository.FindById(Arg.Any <int>()).Returns(new Employee {
                Id = 1, FullName = "Employee"
            });
            this.resource = new SaHoldStoryResource
            {
                HoldStoryId         = 1,
                ReasonStarted       = "test",
                SalesArticle        = "AR",
                DateStarted         = new DateTime().ToShortDateString(),
                PutOnHoldByEmployee = "Employee",
                Links = links
            };

            this.result = this.Sut.Add(this.resource);
        }
Example #4
0
        public void SetUp()
        {
            this.requestResource = new SaHoldStoryResource
            {
                SalesArticle        = "KLIMAX/NTK",
                HoldStoryId         = 1,
                DateStarted         = new DateTime().ToShortDateString(),
                PutOnHoldByEmployee = "Employee",
                ReasonStarted       = "reason",
                Links = new LinkResource[0]
            };

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

            this.Response = this.Browser.Post(
                "/products/maint/sa-hold-stories",
                with =>
            {
                with.Header("Accept", "application/json");
                with.Header("Content-Type", "application/json");
                with.JsonBody(this.requestResource);
            }).Result;
        }