Skip to content
Browse files

Return the same message added

We implement the behavior the unit test specifies: when create() is called we store the message in an array, and when get() is called we return the message at the appropriate index.

Inner Green

Outer Green

With that, both our unit test and feature test are passing. We've finished test-driving our feature! To make sure it works, run your app and see.
  • Loading branch information...
CodingItWrong committed Jan 2, 2018
1 parent ca826cb commit fb849866b7ac39629331929f1c3e0d0e912f85db
Showing with 7 additions and 3 deletions.
  1. +7 −3 LearnTDDInCocoaTouch/MessageStore.swift
@@ -2,14 +2,18 @@ import Foundation

class MessageStore {

var count = 0
var messages: [String] = []

var count: Int {
return messages.count

func create(_ message: String) {
count += 1

func get(_ index: Int) -> String {
return "fake message"
return messages[index]


0 comments on commit fb84986

Please sign in to comment.
You can’t perform that action at this time.