Mockingbird Documentation 0.14.1

Function sequence(of:​)

public func sequence<DeclarationType: Declaration, InvocationType, ReturnType>(of values: ReturnType) -> ImplementationProvider<DeclarationType, InvocationType, ReturnType>

Stub a sequence of values.

Provide one or more values which will be returned sequentially for each invocation. The last value will be used if the number of invocations is greater than the number of values provided.

given(bird.getName())
  .willReturn(sequence(of: "Ryan", "Sterling"))

print(bird.name)  // Prints "Ryan"
print(bird.name)  // Prints "Sterling"
print(bird.name)  // Prints "Sterling"

Parameters

values Return​Type

A sequence of values to stub.