public void CanEnableDataCaptureOnUpdate() { using (var context = FluentMockContext.Start(GetType().FullName)) { var region = Region.USEast; var groupName = TestUtilities.GenerateName("rgns"); var azure = TestHelper.CreateRollupClient(); try { var stgName = TestUtilities.GenerateName("stg"); var namespaceName = TestUtilities.GenerateName("ns111"); var eventHubName = TestUtilities.GenerateName("eh"); var namespaceCreatable = azure.EventHubNamespaces .Define(namespaceName) .WithRegion(region) .WithNewResourceGroup(groupName); IEventHub eventHub = azure.EventHubs .Define(eventHubName) .WithNewNamespace(namespaceCreatable) .Create(); bool exceptionThrown = false; try { eventHub.Update() .WithDataCaptureEnabled() .Apply(); } catch { exceptionThrown = true; } Assert.True(exceptionThrown, "Expected IllegalStateException is not thrown"); eventHub = eventHub.Refresh(); var storageAccountCreatable = azure.StorageAccounts .Define(stgName) .WithRegion(region) .WithNewResourceGroup(groupName) .WithSku(StorageAccountSkuType.Standard_LRS); eventHub.Update() .WithDataCaptureEnabled() .WithNewStorageAccountForCapturedData(storageAccountCreatable, "eventctr") .Apply(); Assert.True(eventHub.IsDataCaptureEnabled); Assert.NotNull(eventHub.CaptureDestination); Assert.Contains("/storageAccounts/", eventHub.CaptureDestination.StorageAccountResourceId); Assert.Contains(stgName, eventHub.CaptureDestination.StorageAccountResourceId); Assert.Equal("eventctr", eventHub.CaptureDestination.BlobContainer, ignoreCase: true); } finally { try { azure.ResourceGroups.DeleteByName(groupName); } catch { } } } }