Ejemplo n.º 1
0
        public void DoubleParameterDoWithNullActionThrows()
        {
            var builder = new DelegatingSpecimenBuilder();

            Assert.Throws <ArgumentNullException>(() =>
                                                  builder.Do <double, decimal>(null));
        }
Ejemplo n.º 2
0
        public void SingleParameterDoWillInvokeMethodWithCorrectParameter(
            int expected)
        {
            // Fixture setup
            var builder = new DelegatingSpecimenBuilder();
            builder.OnCreate = (r, c) => expected;

            var verified = false;
            var mock = new CommandMock<int>();
            mock.OnCommand = x => verified = expected == x;
            // Exercise system
            builder.Do((int i) => mock.Command(i));
            // Verify outcome
            Assert.True(verified, "Mock wasn't verified.");
            // Teardown
        }
Ejemplo n.º 3
0
        public void SingleParameterDoWillInvokeMethodWithCorrectParameter(
            int expected)
        {
            // Arrange
            var builder = new DelegatingSpecimenBuilder();

            builder.OnCreate = (r, c) => expected;

            var verified = false;
            var mock     = new CommandMock <int>();

            mock.OnCommand = x => verified = expected == x;
            // Act
            builder.Do((int i) => mock.Command(i));
            // Assert
            Assert.True(verified, "Mock wasn't verified.");
        }
Ejemplo n.º 4
0
        public void SingleParameterDoWillInvokeMethodWithCorrectParameter(
            int expected)
        {
            // Fixture setup
            var builder = new DelegatingSpecimenBuilder();

            builder.OnCreate = (r, c) => expected;

            var verified = false;
            var mock     = new CommandMock <int>();

            mock.OnCommand = x => verified = expected == x;
            // Exercise system
            builder.Do((int i) => mock.Command(i));
            // Verify outcome
            Assert.True(verified, "Mock wasn't verified.");
            // Teardown
        }
Ejemplo n.º 5
0
 public void DoubleParameterDoWithNullActionThrows()
 {
     var builder = new DelegatingSpecimenBuilder();
     Assert.Throws<ArgumentNullException>(() =>
         builder.Do<double, decimal>(null));
 }