public void Test_Using_Also_With_A_Null_Action() { DummyClass instance = new DummyClass(); Action action = () => instance.Also(null); action.Should() .ThrowExactly <ArgumentNullException>() .WithMessage($"*action*"); }
public void Test_Using_Also_In_A_Null_Object() { DummyClass instance = null; string expected = nameof(DummyClass); string actionResult = null; DummyClass result = instance.Also(argument => { argument.Should().BeNull(); actionResult = expected; }); result.Should().BeNull(); actionResult.Should().Be(expected); }
public void Test_Using_Also_In_An_Object() { DummyClass instance = new DummyClass() { Value = nameof(DummyClass) }; string actionResult = null; DummyClass result = instance.Also(argument => { argument.Should().BeSameAs(instance); actionResult = argument.Value; }); result.Should().BeSameAs(instance); actionResult.Should().BeSameAs(instance.Value); }