diff --git a/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata.xcodeproj/project.xcworkspace/xcuserdata/khoovis.xcuserdatad/UserInterfaceState.xcuserstate b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata.xcodeproj/project.xcworkspace/xcuserdata/khoovis.xcuserdatad/UserInterfaceState.xcuserstate index 05dc584..5295f3d 100644 Binary files a/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata.xcodeproj/project.xcworkspace/xcuserdata/khoovis.xcuserdatad/UserInterfaceState.xcuserstate and b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata.xcodeproj/project.xcworkspace/xcuserdata/khoovis.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata.xcodeproj/xcshareddata/xcschemes/Theatrical-Players-Refactoring-Kata.xcscheme b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata.xcodeproj/xcshareddata/xcschemes/Theatrical-Players-Refactoring-Kata.xcscheme new file mode 100644 index 0000000..04f4b28 --- /dev/null +++ b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata.xcodeproj/xcshareddata/xcschemes/Theatrical-Players-Refactoring-Kata.xcscheme @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata.xcodeproj/xcuserdata/khoovis.xcuserdatad/xcschemes/xcschememanagement.plist b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata.xcodeproj/xcuserdata/khoovis.xcuserdatad/xcschemes/xcschememanagement.plist index 9f679f8..e4fa6d0 100644 --- a/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata.xcodeproj/xcuserdata/khoovis.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata.xcodeproj/xcuserdata/khoovis.xcuserdatad/xcschemes/xcschememanagement.plist @@ -10,5 +10,18 @@ 0 + SuppressBuildableAutocreation + + 104F7D7323282F2900665957 + + primary + + + 104F7D7C23282F2900665957 + + primary + + + diff --git a/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata/Invoice.swift b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata/Invoice.swift index 06ed6a5..807e0bf 100644 --- a/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata/Invoice.swift +++ b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata/Invoice.swift @@ -1,8 +1,4 @@ struct Invoice { let customer: String let performances: [Performance] - init(_ customer: String, _ performances: Array) { - self.customer = customer - self.performances = performances - } } diff --git a/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata/Performance.swift b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata/Performance.swift index 690118c..2cc88ae 100644 --- a/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata/Performance.swift +++ b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata/Performance.swift @@ -1,8 +1,4 @@ struct Performance { let playID: String let audience: Int - init(_ playID: String, _ audience: Int) { - self.playID = playID - self.audience = audience - } } diff --git a/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata/Play.swift b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata/Play.swift index 1069c21..977e865 100644 --- a/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata/Play.swift +++ b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata/Play.swift @@ -1,7 +1,3 @@ struct Play { let name, type: String - init(_ name: String, _ type: String) { - self.name = name - self.type = type - } } diff --git a/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata/StatementPrinter.swift b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata/StatementPrinter.swift index 6b204cb..c5781ec 100644 --- a/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata/StatementPrinter.swift +++ b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-Kata/StatementPrinter.swift @@ -52,5 +52,3 @@ class StatementPrinter { enum UnknownTypeError: Error { case unknownTypeError(String) } - -// TODO: get test to pass and coverage, destructure performance object in for loop diff --git a/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-KataTests/StatementPrinterTests.swift b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-KataTests/StatementPrinterTests.swift index 1fb37bd..b80d78c 100644 --- a/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-KataTests/StatementPrinterTests.swift +++ b/swift/Theatrical-Players-Refactoring-Kata/Theatrical-Players-Refactoring-KataTests/StatementPrinterTests.swift @@ -7,43 +7,44 @@ class StatementPrinterTests: XCTestCase { let expected = """ Statement for BigCo - Hamlet: $650.00 (55 seats) - As You Like It: $580.00 (35 seats) - Othello: $500.00 (40 seats) + Hamlet: $650.00 (55 seats) + As You Like It: $580.00 (35 seats) + Othello: $500.00 (40 seats) Amount owed is $1,730.00 You earned 47 credits + """ let plays = [ - "hamlet": Play("Hamlet", "tragedy"), - "as-like": Play("As You Like It", "comedy"), - "othello": Play("Othello", "tragedy") + "hamlet": Play(name: "Hamlet", type: "tragedy"), + "as-like": Play(name: "As You Like It", type: "comedy"), + "othello": Play(name: "Othello", type: "tragedy") ] let invoice = Invoice( - "BigCo", [ - Performance("hamlet", 55), - Performance("as-like", 35), - Performance("othello", 40) + customer: "BigCo", performances: [ + Performance(playID: "hamlet", audience: 55), + Performance(playID: "as-like", audience: 35), + Performance(playID: "othello", audience: 40) ] ) let statementPrinter = StatementPrinter() let result = try statementPrinter.print(invoice, plays) - XCTAssertEqual(expected, result) + XCTAssertEqual(result, expected) } func test_statementWithNewPlayTypes() { let plays = [ - "henry-v": Play("Henry V", "history"), - "as-like": Play("As You Like It", "pastoral") + "henry-v": Play(name: "Henry V", type: "history"), + "as-like": Play(name: "As You Like It", type: "pastoral") ] let invoice = Invoice( - "BigCo", [ - Performance("henry-v", 53), - Performance("as-like", 55) + customer: "BigCo", performances: [ + Performance(playID: "henry-v", audience: 53), + Performance(playID: "as-like", audience: 55) ] )