public void InvokeVoidMethodMetricsTest() { testMethodInvocation = new MethodInvocation("TestMethod"); Expect.Once.On(mockMethodInvocationSerializer).Method("Serialize").WithAnyArguments().Will(Return.Value(testSerializedMethodInvocation)); Expect.Once.On(mockRemoteReceiver).Method("Receive").WithAnyArguments().Will(Return.Value(testVoidSerializedReturnValue)); Expect.Once.On(mockMethodInvocationSerializer).GetProperty("VoidReturnValue").Will(Return.Value(testVoidSerializedReturnValue)); Expect.AtLeastOnce.On(mockRemoteSender); using (mocks.Ordered) { Expect.Once.On(mockMetricLogger).Method("Begin").With(IsMetric.Equal(new RemoteMethodSendTime())); Expect.Once.On(mockMetricLogger).Method("End").With(IsMetric.Equal(new RemoteMethodSendTime())); Expect.Once.On(mockMetricLogger).Method("Increment").With(IsMetric.Equal(new RemoteMethodSent())); } testMethodInvocationRemoteSender.InvokeVoidMethod(testMethodInvocation); mocks.VerifyAllExpectationsHaveBeenMet(); }
public void InvokeVoidMethodLoggingTest() { testMethodInvocation = new MethodInvocation("TestMethod"); using (mocks.Ordered) { Expect.Once.On(mockMethodInvocationSerializer).Method("Serialize").WithAnyArguments().Will(Return.Value(testSerializedMethodInvocation)); Expect.Once.On(mockRemoteReceiver).Method("Receive").WithAnyArguments().Will(Return.Value(testVoidSerializedReturnValue)); Expect.Once.On(mockMethodInvocationSerializer).GetProperty("VoidReturnValue").Will(Return.Value(testVoidSerializedReturnValue)); Expect.Once.On(mockApplicationLogger).Method("Log").With(testMethodInvocationRemoteSender, LogLevel.Information, "Invoked void method 'TestMethod'."); } Expect.AtLeastOnce.On(mockRemoteSender); testMethodInvocationRemoteSender.InvokeVoidMethod(testMethodInvocation); mocks.VerifyAllExpectationsHaveBeenMet(); }
public void Initialise() { methodInvocationSender.InvokeVoidMethod(new MethodInvocation("Initialise")); }