I enterred the following code into CourseTest.swift:
import XCTest
import RanchForecast
class CourseTest : XCTestCase {
func testCourseInitialization() {
let course = Course(title: Constants.title, url: Constants.url, nextStartDate: Constants.date)
}
}
The compiler keeps complaining that :
…/dev/Swift/RanchForecast/RanchForecastTests/CourseTest.swift:20:22: Use of unresolved identifier ‘Course’
Any ideas?
Thank you,
Ray
Just saw the answer in the Text.
From a data encapsulation point of view, wouldn’t the be a great time to have getter/setters?
Of course with Swift 2.0 you should use
and don’t make any of your types public just for testing!
[quote=“tkrajacic”]Of course with Swift 2.0 you should use
and don’t make any of your types public just for testing![/quote]
it still doesn’t work
I’m having the same issue with Course being labeled a 'Use of an unresolved identifier ‘Course’. in my TestCourseInitialization() fund.
on my import RanchForecast line
I get a warning
the file CourseTest.swift is part of a module ‘RanchForecast’; ignoring import. Which I’m sure is related.
I have followed all the suggestions in the other posts but can’t get it to work. I may just start again.
I’m assuming the code that is no longer shown above looks something like this:
import XCTest
@testable import RanchForecast
class CourseTests: XCTestCase {
func testCourseInitialization() {
let course = Course(title: Constants.title,
url: Constants.url,
nextStartDate: Constants.date)
XCTAssertEqual(course.title, Constants.title)
XCTAssertEqual(course.url, Constants.url)
XCTAssertEqual(course.nextStartDate, Constants.date)
}
The test runs and passes and nothing was made public.