Пример #1
0
        public async Task GetHostAsync_ValidParameters_ExpectedResult()
        {
            IUKFastECloudClient client = Substitute.For <IUKFastECloudClient>();

            client.GetAsync <Host>("/ecloud/v1/hosts/123").Returns(new Host()
            {
                ID = 123
            });

            var ops      = new HostOperations <Host>(client);
            var hostitem = await ops.GetHostAsync(123);

            Assert.AreEqual(123, hostitem.ID);
        }
Пример #2
0
        public async Task GetHostAsync_InvalidHostID_ThrowsUKFastClientValidationException()
        {
            var ops = new HostOperations <Host>(null);

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