Esempio n. 1
0
        public void Test_Using_Also_With_A_Null_Action()
        {
            DummyClass instance = new DummyClass();
            Action     action   = () => instance.Also(null);

            action.Should()
            .ThrowExactly <ArgumentNullException>()
            .WithMessage($"*action*");
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
        }