예제 #1
0
        public void DoubleParameterDoWithNullActionThrows()
        {
            var builder = new DelegatingSpecimenBuilder();

            Assert.Throws <ArgumentNullException>(() =>
                                                  builder.Do <double, decimal>(null));
        }
예제 #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
        }
예제 #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.");
        }
예제 #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
        }
예제 #5
0
 public void DoubleParameterDoWithNullActionThrows()
 {
     var builder = new DelegatingSpecimenBuilder();
     Assert.Throws<ArgumentNullException>(() =>
         builder.Do<double, decimal>(null));
 }