Exemplo n.º 1
0
        public void SomethingStrange()
        {
            Action action = () =>
            {
                EnsureExpression
                // WILL allocate a local func to capture your variable
                .That(() => 1 + 3)
                .Is(0);
            };

            action.Should().Throw <NotSupportedException>();
        }
Exemplo n.º 2
0
        public void PropertyName()
        {
            Action action = () =>
            {
                EnsureExpression
                // WILL allocate a local func to capture your variable
                .That(() => Console.Out.NewLine)
                .Is(null);
            };

            action.Should().Throw <ArgumentException>()
            // TODO: We probably want it to get the whole Console.Out.NewLine
            .WithMessage("*(Parameter 'NewLine')");
        }
Exemplo n.º 3
0
        public void LocalVariableName()
        {
            string variable = null;

            Action action = () =>
            {
                EnsureExpression
                // WILL allocate a local func to capture your variable
                .That(() => variable)
                .IsNotNull();
            };

            action.Should().Throw <ArgumentNullException>()
            .WithMessage("Value can not be null. (Parameter 'variable')");
        }