ExecuteAndGetInnerException() public static method

public static ExecuteAndGetInnerException ( Func action ) : Exception
action Func
return System.Exception
Esempio n. 1
0
        public void Should_throw_not_found_exception_when_applying_conflict_on_missing_file()
        {
            var client = NewAsyncClient(1);

            var guid           = Guid.NewGuid().ToString();
            var innerException = SyncTestUtils.ExecuteAndGetInnerException(async() =>
                                                                           await client.Synchronization.ApplyConflictAsync("test.bin", 8, guid, new RavenJObject(), "http://localhost:12345"));

            Assert.IsType <FileNotFoundException>(innerException.GetBaseException());
        }
Esempio n. 2
0
        public async Task Should_refuse_to_upload_file_while_sync_configuration_exists()
        {
            IAsyncFilesCommands destinationClient;
            IAsyncFilesCommands sourceClient;

            UploadFilesSynchronously(out sourceClient, out destinationClient);

            await destinationClient.Configuration.SetKeyAsync(RavenFileNameHelper.SyncLockNameForFile("test.bin"), SynchronizationConfig(DateTime.UtcNow));

            var innerException = SyncTestUtils.ExecuteAndGetInnerException(async() => await destinationClient.UploadAsync("test.bin", new MemoryStream()));

            Assert.IsType(typeof(SynchronizationException), innerException.GetBaseException());
            Assert.Equal(string.Format("File {0} is being synced", FileHeader.Canonize("test.bin")), innerException.GetBaseException().Message);
        }
Esempio n. 3
0
        public async Task Should_refuse_to_delete_file_while_sync_configuration_exists()
        {
            RavenFileSystemClient destinationClient;
            RavenFileSystemClient sourceClient;

            UploadFilesSynchronously(out sourceClient, out destinationClient);

            await destinationClient.Config.SetConfig(RavenFileNameHelper.SyncLockNameForFile("test.bin"), SynchronizationConfig(DateTime.UtcNow));

            var innerException = SyncTestUtils.ExecuteAndGetInnerException(async() => await destinationClient.DeleteAsync("test.bin"));

            Assert.IsType(typeof(SynchronizationException), innerException.GetBaseException());
            Assert.Equal("File test.bin is being synced", innerException.GetBaseException().Message);
        }
Esempio n. 4
0
        public async Task Should_refuse_to_update_metadata_while_sync_configuration_exists()
        {
            IAsyncFilesCommands destinationClient;
            IAsyncFilesCommands sourceClient;

            UploadFilesSynchronously(out sourceClient, out destinationClient);

            await destinationClient.Configuration.SetKeyAsync(RavenFileNameHelper.SyncLockNameForFile("test.bin"), SynchronizationConfig(DateTime.UtcNow));

            var innerException = SyncTestUtils.ExecuteAndGetInnerException(async() => await destinationClient.UpdateMetadataAsync("test.bin", new RavenJObject()));

            Assert.IsType(typeof(SynchronizationException), innerException.GetBaseException());
            Assert.Equal("File test.bin is being synced", innerException.GetBaseException().Message);
        }