public void SendAfterDispose()
        {
            SetDisposeExpectations();
            testFileRemoteSender.Dispose();
            ObjectDisposedException e = Assert.Throws <ObjectDisposedException>(delegate
            {
                testFileRemoteSender.Send(testMessage);
            });

            mocks.VerifyAllExpectationsHaveBeenMet();
            Assert.AreEqual(e.ObjectName, "FileRemoteSender");
        }
        public void SendMetricsTest()
        {
            Expect.AtLeastOnce.On(mockMessageFile);
            Expect.AtLeastOnce.On(mockLockFile);
            Expect.AtLeastOnce.On(mockFileSystem);
            using (mocks.Ordered)
            {
                Expect.Once.On(mockMetricLogger).Method("Begin").With(IsMetric.Equal(new MessageSendTime()));
                Expect.Once.On(mockMetricLogger).Method("End").With(IsMetric.Equal(new MessageSendTime()));
                Expect.Once.On(mockMetricLogger).Method("Increment").With(IsMetric.Equal(new MessageSent()));
            }

            testFileRemoteSender.Send("<TestMessage>Test message content</TestMessage>");

            mocks.VerifyAllExpectationsHaveBeenMet();
        }
        public void SendLoggingTest()
        {
            Expect.AtLeastOnce.On(mockMessageFile);
            Expect.AtLeastOnce.On(mockLockFile);
            Expect.AtLeastOnce.On(mockFileSystem);
            Expect.Once.On(mockApplicationLogger).Method("Log").With(testFileRemoteSender, LogLevel.Information, "Message sent.");

            testFileRemoteSender.Send("<TestMessage>Test message content</TestMessage>");

            mocks.VerifyAllExpectationsHaveBeenMet();
        }