我确信我在这里遗漏了一些明显的东西(失败等于比较通常很简单),但我很茫然。我有单个断言的单元测试:
ReactiveAssert.AreElementsEqual(expected.ToList(), actual.Messages.ToList());
预期为{Microsoft.Reactive.Testing.Recorded<System.Reactive.Notification<Services.Messaging.Interfaces.IMessage>>
和实际是
{Microsoft.Reactive.Testing.MockObserver<Services.Messaging.Interfaces.IMessage>}
两者都转换为List<OnNext(Services.Messaging.Messages.RolloverMessage)>
个对象,然后进行比较。所以我得到的错误信息是:
预期:[OnNext(Services.Messaging.Messages.RolloverMessage)@ 1, OnNext(Services.Messaging.Messages.RolloverMessage)@10000001, OnNext(Services.Messaging.Messages.RolloverMessage)@20000001, OnNext(Services.Messaging.Messages.RolloverMessage)@30000001, OnNext(Services.Messaging.Messages.RolloverMessage)@40000001]
实际..:[OnNext(Services.Messaging.Messages.RolloverMessage)@ 1, OnNext(Services.Messaging.Messages.RolloverMessage)@10000001, OnNext(Services.Messaging.Messages.RolloverMessage)@20000001, OnNext(Services.Messaging.Messages.RolloverMessage)@30000001, OnNext(Services.Messaging.Messages.RolloverMessage)@40000001]
预期:真实:虚假
这令人困惑和愤怒。有什么建议?我遗漏了哪些有用的信息?