public void GivenEventHubNullConnectionStringAndName_WhenAddSender_ThenInvalidOperationExceptionThrown_Test()
        {
            var options = new EventHubMeasurementCollectorOptions();
            var ex      = Assert.Throws <InvalidOperationException>(() => options.GetEventHubClient("test", null));

            Assert.Contains("test", ex.Message);
        }
        public void GivenNewEventHubConnectionStringAndName_WhenGetEventHubClient_ThenEventHubClientReturned_Test()
        {
            var options = new EventHubMeasurementCollectorOptions();

            var cs     = CreateTestConnectionString();
            var client = options.GetEventHubClient("test", cs);

            Assert.NotNull(client);
        }
        public void GivenEventHubConnectionStringWithoutEntityPathAndName_WhenAddSender_ThenNameUsedForEntityPath_Test()
        {
            var options = new EventHubMeasurementCollectorOptions();

            var cs     = "Endpoint=sb://test/;SharedAccessKeyName=name;SharedAccessKey=key;";
            var client = options.GetEventHubClient("testA", cs);

            Assert.NotNull(client);

            Assert.Equal("testA", client.EventHubName);
        }
        public void GivenRepeatedDifferentEventHubConnectionStringAndName_WhenGetEventHubClient_ThenDifferentEventHubClientReturned_Test()
        {
            var options = new EventHubMeasurementCollectorOptions();

            var cs      = CreateTestConnectionString();
            var client1 = options.GetEventHubClient("test1", cs);

            Assert.NotNull(client1);

            var client2 = options.GetEventHubClient("test2", cs);

            Assert.NotNull(client2);

            Assert.NotEqual(client1, client2);
        }