public async Task NotificationReaderDisposeShouldInvokeStreamDisposedAsync() { await using (var notificationReader = new ODataNotificationReader( this.reader, this.streamListener)) // `synchronous` argument becomes irrelevant since we'll directly call DisposeAsync { } var result = await this.ReadStreamContentsAsync(); Assert.Equal("StreamDisposedAsync", result); }
public async Task NotificationReaderDisposeShouldInvokeStreamDisposedAsync() { using (var notificationReader = new ODataNotificationReader( this.reader, this.streamListener, /*synchronous*/ false)) { } var result = await this.ReadStreamContentsAsync(); Assert.Equal("StreamDisposedAsync", result); }
public void NotificationReaderDisposeShouldInvokeStreamDisposed(bool synchronous, string expected) { // We care about the notification reader being disposed // We don't care about the reader passed to the notification reader using (var notificationReader = new ODataNotificationReader( this.reader, this.streamListener, synchronous)) { } var result = ReadStreamContents(); Assert.Equal(expected, result); }
public async Task NotificationReaderDisposeAsyncShouldBeIdempotent() { var notificationReader = new ODataNotificationReader( this.reader, this.streamListener); // 1st call to DisposeAsync await notificationReader.DisposeAsync(); // 2nd call to DisposeAsync await notificationReader.DisposeAsync(); var result = await this.ReadStreamContentsAsync(); // StreamDisposeAsync was written only once Assert.Equal("StreamDisposedAsync", result); }
public void NotificationReaderDisposeShouldBeIdempotent(bool synchronous, string expected) { var notificationReader = new ODataNotificationReader( this.reader, this.streamListener, synchronous); // 1st call to Dispose notificationReader.Dispose(); // 2nd call to Dispose notificationReader.Dispose(); var result = ReadStreamContents(); // StreamDisposed/StreamDisposeAsync was written only once Assert.Equal(expected, result); }