Example #1
0
            public override bool TryGetMember(GetMemberBinder binder, out object result)
            {
                var path  = Path.Combine(TestContext.CurrentContext.TestDirectory, "Data", category);
                var files = Directory.GetFiles(path, binder.Name + ".*");

                if (files.Length != 1)
                {
                    throw new FileNotFoundException($"Cannot find file: {category}/{binder.Name}");
                }

                result = new FileTestBase(Path.Combine(category, binder.Name + Path.GetExtension(files[0])));

                return(true);
            }
        private static void TestShareFetchAttributes(LocationMode?optionsLocationMode, LocationMode clientLocationMode, StorageLocation initialLocation, IList <RetryContext> retryContextList, IList <RetryInfo> retryInfoList)
        {
            CloudFileShare share = FileTestBase.GetRandomShareReference();

            using (MultiLocationTestHelper helper = new MultiLocationTestHelper(share.ServiceClient.StorageUri, initialLocation, retryContextList, retryInfoList))
            {
                share.ServiceClient.DefaultRequestOptions.LocationMode = clientLocationMode;
                FileRequestOptions options = new FileRequestOptions()
                {
                    LocationMode = optionsLocationMode,
                    RetryPolicy  = helper.RetryPolicy,
                };

                TestHelper.ExpectedException(
                    () => share.FetchAttributes(null, options, helper.OperationContext),
                    "FetchAttributes on a non-existing share should fail",
                    HttpStatusCode.NotFound);
            }
        }