public void When_DequeHasCountZero_Peek_ShouldReturnError() { DequeModel <int> deque = null; OperationStatus status1 = OperationStatus.Ok; OperationStatus status2 = OperationStatus.Ok; "Given there is an deque model with zero items count" .x(() => { deque = new DequeModel <int>(); deque.Initialize(); }); "When user tries to peek items from empty deque" .x(() => { deque.PeekLastItem(); status1 = deque.LastPeekStatus(); deque.PeekHeadItem(); status2 = deque.LastPeekStatus(); }); "Then last peek status should be error" .x(() => { status1.Should().Be(OperationStatus.Error); status2.Should().Be(OperationStatus.Error); }); }
public void When_DequeIsNotInitializedAnyOperation_MustSetNotInitializedError() { DequeModel <int> deque = null; OperationStatus status1 = OperationStatus.Ok; OperationStatus status2 = OperationStatus.Ok; OperationStatus status3 = OperationStatus.Ok; OperationStatus status4 = OperationStatus.Ok; OperationStatus status5 = OperationStatus.Ok; OperationStatus status6 = OperationStatus.Ok; OperationStatus status7 = OperationStatus.Ok; "Given deque which is not initialized" .x(() => { deque = new DequeModel <int>(); }); "When user tries to use deque operations" .x(() => { deque.Enqueue(10); status1 = deque.LastEnqueueStatus(); deque.Dequeue(); status2 = deque.LastDequeueStatus(); deque.PeekHeadItem(); status3 = deque.LastPeekStatus(); deque.Size(); status4 = deque.LastGetSizeStatus(); deque.DequeueLast(); status5 = deque.DequeueLastStatus(); deque.EnqueueFirst(12); status6 = deque.LastEnqueueFirstStatus(); deque.PeekLastItem(); status7 = deque.LastPeekStatus(); }); "Then all statuses should return 'Not initialized'" .x(() => { status1.Should().Be(OperationStatus.NotInitialized); status2.Should().Be(OperationStatus.NotInitialized); status3.Should().Be(OperationStatus.NotInitialized); status4.Should().Be(OperationStatus.NotInitialized); status5.Should().Be(OperationStatus.NotInitialized); status6.Should().Be(OperationStatus.NotInitialized); status7.Should().Be(OperationStatus.NotInitialized); }); }