public void When_Passing_Null_Parameters_Then_Exceptions_Are_Thrown() { // ARRANGE InitializeFakeObjects(); // ACT & ASSERT Assert.ThrowsAsync <ArgumentNullException>(() => _concurrencyManager.TryUpdateRepresentationAsync(null)); Assert.ThrowsAsync <ArgumentNullException>(() => _concurrencyManager.IsRepresentationDifferentAsync(null, null)); Assert.ThrowsAsync <ArgumentNullException>(() => _concurrencyManager.IsRepresentationDifferentAsync("name", null)); Assert.ThrowsAsync <ArgumentNullException>(() => _concurrencyManager.TryGetRepresentationAsync(null)); Assert.ThrowsAsync <ArgumentNullException>(() => _concurrencyManager.RemoveAsync(null)); }
public async Task UpdateHeader( Controller controller, string representationId) { if (controller == null) { throw new ArgumentNullException(nameof(controller)); } if (string.IsNullOrWhiteSpace(representationId)) { throw new ArgumentNullException(nameof(representationId)); } var concurrentObject = await _concurrencyManager.TryGetRepresentationAsync(representationId); if (concurrentObject == null) { return; } SetHeaders(controller, concurrentObject); }