public void GettingTheArgumentsThatWereUsedToCallTheMethod()
        {
            // Create a Stub (fake implementation) of the INotifier interface
            var notifier = MockRepository.GenerateStub<INotifier>();
            
            // Pass the Stub into the SUT
            IReportSender reportSender = new SimpleReportSender(notifier);

            // Exercise the SUT once
            reportSender.PublishReport("Hello World 1");
            
            // Exercise the SUT a second time
            reportSender.PublishReport("Hello World 2");


            var firstCall = notifier.GetArgumentsForCallsMadeOn(x => x.Send(null))[0];
            var secondCall = notifier.GetArgumentsForCallsMadeOn(x => x.Send(null))[1];

            var firstCallFirstArg = firstCall[0];
            var secondCallFirstArg = secondCall[0];


            Assert.That(firstCallFirstArg, Is.EqualTo("Hello World 1"));
            Assert.That(secondCallFirstArg, Is.EqualTo("Hello World 2"));

        }
        public void Add_some_simple_behaviour_to_a_Stub()
        {
            // Create a Stub (fake implementation) of the INotifier interface
            var notifier = MockRepository.GenerateStub<INotifier>();
            
            // Set an expectation that when the Send method is called with any arguments, it returns true
            notifier.Expect(x => x.Send(""))
                .IgnoreArguments()
                .Return(true);

            // Pass the Stub into the SUT
            IReportSender reportSender = new SimpleReportSender(notifier);

            bool result = reportSender.PublishReport("Hello World");

            Assert.That(result, Is.True);
        }
        public void Add_some_simple_behaviour_to_a_Mock()
        {
            // Create a Mock of the INotifier interface
            var notifier = MockRepository.GenerateMock<INotifier>();

            // Set an expectation that when the Send method is called with any arguments, it returns true
            notifier.Expect(x => x.Send(""))
                .IgnoreArguments()
                .Return(true);

            // Pass the Stub into the SUT
            IReportSender reportSender = new SimpleReportSender(notifier);

            // Exercise the SUT
            var result = reportSender.PublishReport("Hello World");

            // Make an assertion on the Mock
            notifier.AssertWasCalled(x => x.Send("Hello World"));

            // Check the expectation was met
            Assert.That(result, Is.True);
        }
        public void Multiple_calls_to_Stub()
        {
            // Create a Stub (fake implementation) of the INotifier interface
            var notifier = MockRepository.GenerateStub<INotifier>();

            // Set an expectation that when the Send method is called with any arguments, it returns true
            notifier.Expect(x => x.Send(""))
                .IgnoreArguments()
                .Return(true)
                //.Repeat.Any()
                ;

            // Pass the Stub into the SUT
            IReportSender reportSender = new SimpleReportSender(notifier);

            // Exercise the SUT once
            bool result = reportSender.PublishReport("Hello World");
            Assert.That(result, Is.True);

            // Exercise the SUT a second time
            result = reportSender.PublishReport("Hello World");
            Assert.That(result, Is.False);
        }