public Task <string> CreateJwe(CreateJweParameter createJweParameter) { if (createJweParameter == null) { throw new ArgumentNullException(nameof(createJweParameter)); } return(_createJweAction.ExecuteAsync(createJweParameter)); }
public void When_Passing_Null_Parameter_Then_Exception_Are_Thrown() { // ARRANGE InitializeFakeObjects(); var createJweParameterWithoutUrl = new CreateJweParameter(); var createJweParameterWithoutJws = new CreateJweParameter { Url = "url" }; var createJweParameterWithoutKid = new CreateJweParameter { Url = "url", Jws = "jws" }; // ACT & ASSERT Assert.ThrowsAsync <ArgumentNullException>(() => _createJweAction.ExecuteAsync(null)).ConfigureAwait(false); Assert.ThrowsAsync <ArgumentNullException>(() => _createJweAction.ExecuteAsync(createJweParameterWithoutUrl)).ConfigureAwait(false); Assert.ThrowsAsync <ArgumentNullException>(() => _createJweAction.ExecuteAsync(createJweParameterWithoutJws)).ConfigureAwait(false); Assert.ThrowsAsync <ArgumentNullException>(() => _createJweAction.ExecuteAsync(createJweParameterWithoutKid)).ConfigureAwait(false); }