Skip to content

Instantly share code, notes, and snippets.

View rpapallas's full-sized avatar

Rafael Papallas rpapallas

View GitHub Profile
@rpapallas
rpapallas / DatabaseManagerTests.swift
Created December 23, 2016 14:32
Minimal Example of Unit Testing Core Data
import XCTest
import CoreData
@testable import DoIt
/// Test the DatabaseManager against a Mock Database Manager.
///
/// Note that testing is done against a mock version of the database, linking
/// to the memory instead of the actual SQLite file.
///
/// - Author:
@rpapallas
rpapallas / MockDatabaseManager.swift
Created December 23, 2016 14:31
Core Data Mock Class for Unit Testing
// This work is licensed under a Creative Commons
// Attribution-ShareAlike 4.0 International License.
// © 2016 Rafael Papallas and www.computingstories.com
import Foundation
import CoreData
/// Mock version of DatabaseManager for testing purposes.
///
/// This intent of this class it to inherit all functionality from DatabaseManager
@rpapallas
rpapallas / DatabaseManager.swift
Last active March 7, 2018 23:11
DatabaseManager class for CoreData
// This work is licensed under a Creative Commons
// Attribution-ShareAlike 4.0 International License.
// © 2016 Rafael Papallas and www.computingstories.com
import Foundation
import CoreData
class DatabaseManager {
/// Implements the Singleton Design Pattern
static let instance = DatabaseManager()
@rpapallas
rpapallas / Factorial.hs
Created October 17, 2016 19:54
Factorial implementation in Haskell
factorial n = product [1..n]