Skip to content

Instantly share code, notes, and snippets.

@CoditCompany
Created August 7, 2018 13:12
Show Gist options
  • Save CoditCompany/38c0831f4224add37d25474435386fac to your computer and use it in GitHub Desktop.
Save CoditCompany/38c0831f4224add37d25474435386fac to your computer and use it in GitHub Desktop.
Writing integration tests for Azure Event Grid - Test
[Fact]
public async Task Publish_ValidParameters_Succeeds()
{
// Arrange
var topicEndpoint = "<topic-endpoint>";
var endpointKey = "<endpoint-key>";
const string eventSubject = "integration-test";
const string eventType = "integration-test-event";
const string licensePlate = "1-TOM-337";
var eventId = Guid.NewGuid().ToString();
var events = new List<NewCarRegisteredEvent>
{
new NewCarRegisteredEvent(licensePlate)
};
// Act
var eventGridPublisher = EventGridPublisher.Create(topicEndpoint, endpointKey);
await eventGridPublisher.Publish(eventSubject, eventType, events, eventId);
// Assert
var receivedEvent = _hybridConnectionHost.GetReceivedEvent(eventId);
Assert.NotEmpty(receivedEvent);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment