public void TestInitialize() { order = new MockInvocationOrder(); mock1 = new Mock <object>(); mock2 = new Mock <object>(); expression1 = o => o.ToString(); expression2 = o => o.GetHashCode(); mock1.SetupWithOrder(expression1, order); mock2.SetupWithOrder(expression2, order); }
public void LogInvocation_logs_to_correct_logger() { // Arrange var order = new MockInvocationOrder(); var mock1 = new Mock <object>(); var mock2 = new Mock <object>(); Expression <Func <object, string> > expression1 = o => o.ToString(); Expression <Func <object, int> > expression2 = o => o.GetHashCode(); order.Setup(mock1, expression1); order.Setup(mock2, expression2); // Act order.LogInvocation(mock1, expression1); order.LogInvocation(mock2, expression2); // Assert var logger1 = order.GetLogger(mock1, expression1); var logger2 = order.GetLogger(mock2, expression2); Assert.AreEqual(1, logger1.LastCall); Assert.AreEqual(2, logger2.LastCall); }