public void DependencyResolverAdder_Add_LatestFactoryIsUsed() { //arrange DependencyResolverAdder sut = CreateDependencyResolverAdder(); foreach (int _ in TestHelper.GenerateMany(TestHelper.GenerateNumber)) { sut.Add(this, type => new Mock <ActorBase>().Object); } //act sut.Add(this, ActorFactory); //assert TestActorRef <ActorBase> result = ActorOfAsTestActorRef <ActorBase>(Sys.DI().Props <DummyActor>()); result.UnderlyingActor.Should().BeSameAs(ReturnedActor); }
public void DependencyResolverAdder_AddWithNullTestKitBaseAndActorFactory_ThrowsArgumentNullException() { //arrange DependencyResolverAdder sut = CreateDependencyResolverAdder(); //act Action act = () => sut.Add(null, null); //assert act.Should().Throw <ArgumentNullException>(); }
public void DependencyResolverAdder_AddWithNullTestKitBase_ThrowsArgumentNullException() { //arrange DependencyResolverAdder sut = CreateDependencyResolverAdder(); //act Action act = () => sut.Add(null, type => new BlackHoleActor()); //assert act.Should().Throw <ArgumentNullException>(); }
public void DependencyResolverAdder_Add_LatestFactoryIsUsed() { //arrange DependencyResolverAdder sut = CreateDependencyResolverAdder(); List <DummyActor> actors = TestUtils.CreateMany <DummyActor>(); foreach (DummyActor actor in actors.Take(actors.Count)) { sut.Add(this, type => actor); } DummyActor expected = new DummyActor(); //act sut.Add(this, type => expected); //assert TestActorRef <ActorBase> result = ActorOfAsTestActorRef <ActorBase>(Sys.DI().Props <DummyActor>()); result.UnderlyingActor.Should().BeSameAs(expected); }
public void DependencyResolverAdder_Add_FactoryIsGivenCorrectType() { //arrange DependencyResolverAdder sut = CreateDependencyResolverAdder(); //act sut.Add(this, ActorFactory); //assert ActorOfAsTestActorRef <ActorBase>(Sys.DI().Props <DummyActor>()); TypeGivenToFactory.Should().Be <DummyActor>(); }
public void DependencyResolverAdder_Add_ResultOfFactoryIsUsedToCreateActors() { //arrange DependencyResolverAdder sut = CreateDependencyResolverAdder(); //act sut.Add(this, ActorFactory); //assert TestActorRef <ActorBase> result = ActorOfAsTestActorRef <ActorBase>(Sys.DI().Props <ActorBase>()); result.UnderlyingActor.Should().BeSameAs(ReturnedActor); }
public void DependencyResolverAdder_Add_FactoryIsGivenCorrectType() { //arrange DependencyResolverAdder sut = CreateDependencyResolverAdder(); DummyActor actor = new DummyActor(); Type actual = null; //act sut.Add(this, type => { actual = type; return(actor); }); //assert ActorOfAsTestActorRef <ActorBase>(Sys.DI().Props <DummyActor>()); actual.Should().Be <DummyActor>(); }