示例#1
0
        public void Function()
        {
            Action act = () =>
            {
                var result = _externalClass.Function();
                ReSharper.TestValueAnalysis(result, result == null /*Expect no warning*/);
            };

            act.ShouldNotThrow();
        }
示例#2
0
        public void FunctionOnExternalClass()
        {
            Action act = () =>
            {
                var result = _externalClass.Function();
                ReSharper.TestValueAnalysis(result, result == null); // unknown nullability
            };

            act.ShouldNotThrow();
        }
示例#3
0
        public void FunctionOnExternalClassOverriddenInInOwnCode()
        {
            Action act = () =>
            {
                var result = _derivedClassInOwnCodeAsExternalClass.Function();
                ReSharper.TestValueAnalysis(result, result == null); // unknown nullability
            };

            act.ShouldThrow <InvalidOperationException>("derived method has been rewritten although external base method is (unannotated) nullable")
            .WithMessage("[NullGuard] Return value * is null.");
        }