Beispiel #1
0
        public async Task GetPodTemplatesPaginatedAsync_ExpectedClientCall()
        {
            IUKFastECloudClient client = Substitute.For <IUKFastECloudClient>();

            client.GetPaginatedAsync <Template>("/ecloud/v1/pods/123/templates").Returns(Task.Run(() =>
            {
                return(new Paginated <Template>(client, "/ecloud/v1/pods/123/templates", null, new Response.ClientResponse <System.Collections.Generic.IList <Template> >()
                {
                    Body = new Response.ClientResponseBody <System.Collections.Generic.IList <Template> >()
                    {
                        Data = new List <Template>()
                        {
                            new Template(),
                            new Template()
                        }
                    }
                }));
            }));

            var ops       = new PodTemplateOperations <Template>(client);
            var paginated = await ops.GetPodTemplatesPaginatedAsync(123);

            Assert.AreEqual(2, paginated.Items.Count);
        }
Beispiel #2
0
        public async Task GetPodTemplatesPaginatedAsync_InvalidPodID_ThrowsUKFastClientValidationException()
        {
            var ops = new PodTemplateOperations <Template>(null);

            await Assert.ThrowsExceptionAsync <UKFastClientValidationException>(() => ops.GetPodTemplatesPaginatedAsync(0));
        }