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