public async Task OnEnterAsyncShouldUpdateState() { var context = A.Dummy <INavigationContext>(); context.State.PersonName = null; var childBlock = A.Dummy <IBlock>(); var sut = new PersonNode("amaterasu", childBlock); var ret = await sut.EnterAsync(context); ret.Should().BeNull(); context.State.PersonName.Should().Be("amaterasu"); }
public async Task OnEnterAsyncShouldRaiseEvent(string personName, string protagonist) { var isProtagonist = personName == protagonist; var context = A.Dummy <INavigationContext>(); context.State.ProtagonistName = protagonist; var invoker = new TestInvoker(context); var childBlock = A.Dummy <IBlock>(); var sut = new PersonNode(personName, childBlock); var ret = await sut.EnterAsync(context); ret.Should().BeNull(); invoker.ShouldContainSingle <IPersonEnterEvent>( i => i.Should().BeEquivalentTo(new { PersonName = personName, IsProtagonist = isProtagonist }) ); }