public void GetMetadata1()
        {
            var mock = new Mock <ECSMetadataServiceCredentialsFetcher>()
            {
                CallBase = true
            };

            int    status    = 200;
            string code      = "ThisIsCode";
            string message   = "ThisIsMessage";
            string requestId = "ThisIsRequestId";

            HttpResponse response = new HttpResponse();

            byte[] content = Encoding.GetEncoding("UTF-8").GetBytes("{\"Code\":\"" + code + "\",\"Message\":\"" + message + "\",\"RequestId\":\"" + requestId + "\"}");
            response.ContentType = FormatType.JSON;
            response.Content     = content;
            response.Status      = status;

            mock.Setup(foo => foo.GetResponse(
                           It.IsAny <HttpRequest>()
                           )).Returns(response);

            ECSMetadataServiceCredentialsFetcher instance = mock.Object;

            string result = instance.GetMetadata();

            Assert.Equal("{\"Code\":\"ThisIsCode\",\"Message\":\"ThisIsMessage\",\"RequestId\":\"ThisIsRequestId\"}", result);
        }
        public void GetMetadata2()
        {
            var mock = new Mock <ECSMetadataServiceCredentialsFetcher>()
            {
                CallBase = true
            };

            WebException exception = new WebException("MockWebExceptionMessage");

            mock.Setup(foo => foo.GetResponse(
                           It.IsAny <HttpRequest>()
                           )).Throws(exception);

            ECSMetadataServiceCredentialsFetcher instance = mock.Object;

            Assert.Throws <ClientException>(
                () =>
            {
                string result = instance.GetMetadata();
            }
                );
        }