public async Task CreateDeleteSchemaGroup() { //create schema group string schemaGroupName = Recording.GenerateAssetName("schemagroup"); SchemaGroupData parameters = new SchemaGroupData() { SchemaType = SchemaType.Avro }; SchemaGroupResource schemaGroup = (await _schemaGroupCollection.CreateOrUpdateAsync(WaitUntil.Completed, schemaGroupName, parameters)).Value; Assert.NotNull(schemaGroup); Assert.AreEqual(schemaGroupName, schemaGroup.Id.Name); //validate if created successfully Assert.IsTrue(await _schemaGroupCollection.ExistsAsync(schemaGroupName)); schemaGroup = await _schemaGroupCollection.GetAsync(schemaGroupName); //delete eventhub await schemaGroup.DeleteAsync(WaitUntil.Completed); //validate var exception = Assert.ThrowsAsync <RequestFailedException>(async() => { await _schemaGroupCollection.GetAsync(schemaGroupName); }); Assert.AreEqual(404, exception.Status); Assert.IsFalse(await _schemaGroupCollection.ExistsAsync(schemaGroupName)); }
public async Task GetAllSchemaGroups() { //create a schema group string schemaGroupName1 = Recording.GenerateAssetName("schemagroup1"); SchemaGroupData parameters = new SchemaGroupData() { SchemaType = SchemaType.Avro }; _ = (await _schemaGroupCollection.CreateOrUpdateAsync(WaitUntil.Completed, schemaGroupName1, parameters)).Value; //validate int count = 0; SchemaGroupResource schemaGroup1 = null; await foreach (SchemaGroupResource schemaGroup in _schemaGroupCollection.GetAllAsync()) { count++; if (schemaGroup.Id.Name == schemaGroupName1) { schemaGroup1 = schemaGroup; } } }