Пример #1
0
            public void WithTestDelegate_AndThrowConstraint_AndMessage_AndArg()
            {
                // Arrange
                var msg = MessageWithArg.CreateRandom();

                // Pre-Assert

                // Act
                ShouldThrow(() => Expect(() =>
                {
                    throw new NotImplementedException();
                },
                                         Throws.Exception.InstanceOf <ArgumentException>(),
                                         msg.Message,
                                         msg.Arg),
                            msg.Expected);
                ShouldNotThrow(() => Expect(() =>
                {
                    throw new ArgumentException();
                },
                                            Throws.Exception.InstanceOf <ArgumentException>(),
                                            msg.Message,
                                            msg.Arg));
                // Assert
            }
Пример #2
0
            public void WithFuncBool_AndMessage_AndArgs()
            {
                // Arrange
                var msg = MessageWithArg.CreateRandom();

                // Pre-Assert

                // Act
                ShouldThrow(() => Expect(() => false, msg.Message, msg.Arg), msg.Expected);
                ShouldNotThrow(() => Expect(() => true, msg.Message, msg.Arg));

                // Assert
            }
Пример #3
0
            public void WithValueAndExpression_AndMessage_AndArgs()
            {
                // Arrange
                var msg = MessageWithArg.CreateRandom();

                // Pre-Assert

                // Act
                ShouldThrow(() => Expect(true, Is.False, msg.Message, msg.Arg), msg.Expected);
                ShouldNotThrow(() => Expect(null, Is.Null, msg.Message, msg.Arg));

                // Assert
            }
Пример #4
0
            public void WithDelegate_AndConstraint_AndMessage_AndArg()
            {
                // Arrange
                var msg  = MessageWithArg.CreateRandom();
                var test = GetRandomInt();

                // Pre-Assert

                // Act
                ShouldThrow(() => Expect(() => test, Is.Not.EqualTo(test), msg.Message, msg.Arg), msg.Expected);
                ShouldNotThrow(() => Expect(() => test, Is.EqualTo(test), msg.Message, msg.Arg));

                // Assert
            }
Пример #5
0
            public void WithBoolCondition_Message_Args()
            {
                // Arrange
                var msg = MessageWithArg.CreateRandom();

                // Pre-Assert

                // Act
                ShouldThrow(
                    () => Expect(false, msg.Message, msg.Arg),
                    msg.Expected
                    );
                ShouldNotThrow(
                    () => Expect(true, msg.Message, msg.Arg)
                    );

                // Assert
            }