public void MiddlewareStart_CorrectEventContent() { var source = new DiagnosticListener("Autofac"); var subscriber = new MockSubscriber(); subscriber.Enable(DiagnosticEventKeys.MiddlewareStart); source.Subscribe(subscriber, subscriber.IsEnabled); var context = MockResolveRequestContext(); source.MiddlewareStart(context, Mock.Of <IResolveMiddleware>()); var e = Assert.Single(subscriber.Events); Assert.Equal(DiagnosticEventKeys.MiddlewareStart, e.Key); Assert.IsType <MiddlewareDiagnosticData>(e.Value); }