Exemplo n.º 1
0
        public void SetUp()
        {
            this.requestResource = new TariffResource
            {
                TariffCode  = "test",
                Description = "test-case"
            };

            var tariff = new Tariff
            {
                TariffCode  = "test",
                Description = "test-case"
            };

            this.TariffService.Add(Arg.Any <TariffResource>(), Arg.Any <IEnumerable <string> >())
            .Returns(new CreatedResult <ResponseModel <Tariff> >(new ResponseModel <Tariff>(tariff, new List <string>())));

            this.Response = this.Browser.Post(
                "/products/maint/tariffs",
                with =>
            {
                with.Header("Accept", "application/json");
                with.Header("Content-Type", "application/json");
                with.JsonBody(this.requestResource);
            }).Result;
        }
Exemplo n.º 2
0
        public void SetUp()
        {
            this.id = 1;

            this.existing = new Tariff
            {
                TariffCode   = "random",
                Description  = "new desc",
                DateInvalid  = 1.August(2017),
                USTariffCode = "changed",
                Id           = 1
            };

            this.resource = new TariffResource
            {
                TariffCode   = "test",
                Description  = "new desc",
                DateInvalid  = 1.August(2018).ToString("o"),
                USTariffCode = "test",
                Links        = new[] { new LinkResource("changed-by", "/employees/123") }
            };
            this.TariffRepository.FindById(this.id)
            .Returns(this.existing);
            this.result = this.Sut.Update(this.id, this.resource);
        }
Exemplo n.º 3
0
        public void SetUp()
        {
            this.resource = new TariffResource
            {
                TariffCode  = "test",
                Description = "Desc",
                Duty        = 1m,
                DateInvalid = 12.December(2018).ToString("o"),
                Links       = new[] { new LinkResource("entered-by", "/employees/123") }
            };

            this.result = this.Sut.Add(this.resource);
        }
Exemplo n.º 4
0
        public void SetUp()
        {
            this.requestResource = new TariffResource()
            {
                Description = "new description", TariffCode = "N"
            };
            var tariff = new Tariff {
                Description = "new description", TariffCode = "N", Id = 1
            };

            this.TariffService.Update(1, Arg.Any <TariffResource>(), Arg.Any <IEnumerable <string> >())
            .Returns(new SuccessResult <ResponseModel <Tariff> >(new ResponseModel <Tariff>(tariff, new List <string>())));

            this.Response = this.Browser.Put(
                "/products/maint/tariffs/1",
                with =>
            {
                with.Header("Accept", "application/json");
                with.Header("Content-Type", "application/json");
                with.JsonBody(this.requestResource);
            }).Result;
        }