Exemplo n.º 1
0
        public void SetUp()
        {
            this.thingId = 123;

            this.resource = new ThingResource {
                Id = this.thingId, Name = "new name"
            };

            this.FacadeService.Update(this.thingId, Arg.Is <ThingResource>(a => a.Id == this.thingId))
            .Returns(
                new SuccessResult <ThingResource>(
                    new ThingResource
            {
                Id    = this.thingId,
                Name  = this.resource.Name,
                Links = new[] { new LinkResource("self", $"/template/things/{this.thingId}") }
            }));

            this.Response = this.Client.Put(
                $"/template/things/{this.thingId}",
                this.resource,
                with =>
            {
                with.Accept("application/json");
            }).Result;
        }
Exemplo n.º 2
0
        public void SetUp()
        {
            this.thingId = 1;
            this.thing   = new ThingResource {
                Id = this.thingId
            };

            this.FacadeService.GetById(this.thingId, Arg.Any <IEnumerable <string> >())
            .Returns(new SuccessResult <ThingResource>(this.thing));

            this.Response = this.Client.Get(
                $"/template/things/{this.thingId}",
                with =>
            {
                with.Accept("application/json");
            }).Result;
        }
Exemplo n.º 3
0
        public void SetUp()
        {
            this.thingResource = new ThingResource {
                Id = 123, Name = "new"
            };

            this.FacadeService.Add(Arg.Any <ThingResource>()).Returns(
                new CreatedResult <ThingResource>(
                    new ThingResource
            {
                Id = 123, Name = "new", Links = new[] { new LinkResource("self", "/template/things/123") }
            }));

            this.Response = this.Client.Post(
                "/template/things",
                this.thingResource,
                with =>
            {
                with.Accept("application/json");
            }).Result;
        }
Exemplo n.º 4
0
 public Response <ThingResource> DoThing(ThingResource resource, CancellationToken cancellationToken = default) => null;