public async Task Should_Throw_If_Stack_Empty() { // Given ViewStackService sut = new ViewStackServiceFixture(); // When var result = await Record.ExceptionAsync(async() => await sut.TopModal()).ConfigureAwait(false); // Then result.Should().BeOfType <ArgumentOutOfRangeException>().Which.ParamName.Should().Be("index"); }
public async Task Should_Not_Pop() { // Given ViewStackService sut = new ViewStackServiceFixture().WithView(Substitute.For <IView>()); await sut.PushModal(new NavigableViewModelMock()); // When await sut.TopModal(); // Then await sut.View.DidNotReceive().PopModal(); }
public async Task Should_Push_Modal() { // Given ViewStackService sut = new ViewStackServiceFixture(); await sut.PushModal(new NavigableViewModelMock()); // When var result = await sut.TopModal(); // Then result.Should().NotBeNull(); result.Should().BeOfType <NavigableViewModelMock>(); }
public async Task Should_Return_Last_Element() { // Given ViewStackService sut = new ViewStackServiceFixture(); await sut.PushModal(new NavigableViewModelMock("1")); await sut.PushModal(new NavigableViewModelMock("2")); // When var result = await sut.TopModal(); // Then result.Should().BeOfType <NavigableViewModelMock>(); result.Id.Should().Be("2"); }
public async Task Should_Throw_If_Stack_Empty() { // Given ViewStackService sut = new ViewStackServiceFixture(); // When var result = await Should.ThrowAsync <InvalidOperationException>(async() => await sut.TopModal()).ConfigureAwait(false); // Then result.Message.ShouldBe("Sequence contains no elements"); }