2
사용할 서비스를 결정할 공장을 지정하고 있습니다. CommunicationJob 클래스의 유닛 테스트를 할 때 IIndex의 모의에 어려움을 겪고 있습니다.양키스 <TKey, TValue>
그리고이 문제는 _cs [n.GetType(). Name] null입니다. 누군가 내 문제에 대한 해결책이 있습니까? 한 가지 해결책은 테스트 전에 Autofac을 시작하는 것이지만, 테스트 컨텍스트에서 AutoFac을로드하는 방법을 알지 못합니다. 이 같은
내 시험보기 :
[Theory]
[InlineData(0)]
[InlineData(1)]
[InlineData(2)]
[InlineData(3)]
public void WithNotifications(int numberOfNotifications)
{
var fixture = new TestCommunicationJobFixture();
var sut = fixture.WithNotifications(numberOfNotifications).GetSut();
sut.Do(new DateTime());
fixture.MockCommunicationService.Verify(x => x["EmailNotification"].Send(It.Is<Notification>(z => z.Sent != null)), Times.Exactly(numberOfNotifications));
fixture.MockNotificationRepo.Verify(x => x.Update(It.Is<Notification>(z => z.Sent != null), true), Times.Exactly(numberOfNotifications));
}
테스트 결과는 어떻게됩니까? –
질문 업데이트 – Rikard
GetSut()은 무엇을합니까? –