public void Dispose_DoesNothingIfInstanceIsAlreadyDisposed() { // Arrange Mock <INodeJSService> mockNodeJSService = _mockRepository.Create <INodeJSService>(); PrismService testSubject = CreatePrismService(mockNodeJSService.Object); // Act testSubject.Dispose(); testSubject.Dispose(); // Assert mockNodeJSService.Verify(n => n.Dispose(), Times.Once()); }
public async Task HighlightAsync_ThrowsObjectDisposedExceptionIfInstanceHasBeenDisposed() { // Arrange PrismService testSubject = CreatePrismService(); testSubject.Dispose(); // Act and assert ObjectDisposedException result = await Assert. ThrowsAsync <ObjectDisposedException>(async() => await testSubject.HighlightAsync(null, null).ConfigureAwait(false)). ConfigureAwait(false); }
public async Task IsValidLanguageAliasAsync_ThrowsObjectDisposedExceptionIfInstanceHasBeenDisposed() { // Arrange using (PrismService testSubject = CreatePrismService()) { testSubject.Dispose(); // Act and assert ObjectDisposedException result = await Assert. ThrowsAsync <ObjectDisposedException>(async() => await testSubject.IsValidLanguageAliasAsync(null, default(CancellationToken)).ConfigureAwait(false)). ConfigureAwait(false); } }