public async Task CreateDeleteConsumerGroup() { //create consumer group string consumerGroupName = Recording.GenerateAssetName("testconsumergroup"); ConsumerGroupResource consumerGroup = (await _consumerGroupCollection.CreateOrUpdateAsync(WaitUntil.Completed, consumerGroupName, new ConsumerGroupData())).Value; Assert.NotNull(consumerGroup); Assert.AreEqual(consumerGroup.Id.Name, consumerGroupName); //validate if created successfully Assert.IsTrue(await _consumerGroupCollection.ExistsAsync(consumerGroupName)); consumerGroup = await _consumerGroupCollection.GetAsync(consumerGroupName); //delete consumer group await consumerGroup.DeleteAsync(WaitUntil.Completed); //validate var exception = Assert.ThrowsAsync <RequestFailedException>(async() => { await _consumerGroupCollection.GetAsync(consumerGroupName); }); Assert.AreEqual(404, exception.Status); Assert.IsFalse(await _consumerGroupCollection.ExistsAsync(consumerGroupName)); }
public async Task CreateDeleteConsumerGroup() { //create consumer group string consumerGroupName = Recording.GenerateAssetName("testconsumergroup"); ConsumerGroup consumerGroup = (await _consumerGroupCollection.CreateOrUpdateAsync(WaitUntil.Completed, consumerGroupName, new ConsumerGroupData())).Value; Assert.NotNull(consumerGroup); Assert.AreEqual(consumerGroup.Id.Name, consumerGroupName); //validate if created successfully consumerGroup = await _consumerGroupCollection.GetIfExistsAsync(consumerGroupName); Assert.NotNull(consumerGroup); Assert.IsTrue(await _consumerGroupCollection.ExistsAsync(consumerGroupName)); //delete consumer group await consumerGroup.DeleteAsync(WaitUntil.Completed); //validate consumerGroup = await _consumerGroupCollection.GetIfExistsAsync(consumerGroupName); Assert.Null(consumerGroup); Assert.IsFalse(await _consumerGroupCollection.ExistsAsync(consumerGroupName)); }