public void Should_Return_Parameter_If_Parameter_Is_Not_Null() { // Arrange var baseClass = new BaseClass(); // Act var value = MaybeUtils.CheckParameterNotNull(baseClass, nameof(baseClass)); //Assert value.ShouldBe(baseClass); }
public void Should_Throw_InvalidOperationException_If_Parameter_Is_Null() { // Arrange var parameterName = "parameterName"; // Act var exception = Record.Exception(() => MaybeUtils.CheckParameterNotNull <BaseClass>(null, parameterName)); // Assert exception.ShouldBeOfType <InvalidOperationException>(); exception.Message.ShouldContain(parameterName); }