public void TestDequeueWhenChainMocksAndNotUsages() { var httpRequestMock = CreateMock("get"); var mocks = new[] { CreateMock("get"), httpRequestMock }; var handlingMockQueue = new HandlingMockQueue(); handlingMockQueue.Enqueue(mocks); var handlingInfo = handlingMockQueue.Dequeue(CreateRequestInfo("get", "/")); handlingInfo.Should().NotBeNull(); handlingInfo.IsUsageCountValid().Should().BeTrue(); handlingInfo.HasAttempts().Should().BeFalse(); handlingInfo.UsageCount.ShouldBeEquivalentTo(1); handlingInfo = handlingMockQueue.Dequeue(CreateRequestInfo("get", "/")); handlingInfo.Should().NotBeNull(); handlingInfo.IsUsageCountValid().Should().BeTrue(); handlingInfo.HasAttempts().Should().BeFalse(); handlingInfo.UsageCount.ShouldBeEquivalentTo(1); handlingInfo = handlingMockQueue.Dequeue(CreateRequestInfo("get", "/")); handlingInfo.Should().NotBeNull(); handlingInfo.IsUsageCountValid().Should().BeFalse(); handlingInfo.HasAttempts().Should().BeFalse(); handlingInfo.UsageCount.ShouldBeEquivalentTo(2); handlingInfo.ResponseMock.Should().Be(httpRequestMock.Response); }
public void TestDequeueWhenEmpty() { var handlingMockQueue = new HandlingMockQueue(); handlingMockQueue.Enqueue(new HttpRequestMock[0]); handlingMockQueue.Dequeue(CreateRequestInfo("get", "/")).Should().BeNull(); }
public void TestDequeueWhenOneMock() { var mocks = new[] { CreateMock("get") }; var handlingMockQueue = new HandlingMockQueue(); handlingMockQueue.Enqueue(mocks); var handlingInfo = handlingMockQueue.Dequeue(CreateRequestInfo("get", "/")); handlingInfo.Should().NotBeNull(); handlingInfo.IsUsageCountValid().Should().BeTrue(); handlingInfo.HasAttempts().Should().BeFalse(); handlingInfo.UsageCount.ShouldBeEquivalentTo(1); handlingInfo = handlingMockQueue.Dequeue(CreateRequestInfo("get", "/")); handlingInfo.Should().NotBeNull(); handlingInfo.IsUsageCountValid().Should().BeFalse(); handlingInfo.HasAttempts().Should().BeFalse(); handlingInfo.UsageCount.ShouldBeEquivalentTo(2); }