This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Test</title> | |
</head> | |
<body> | |
<!--Body content--> | |
</body> | |
<script type="text/javascript" src="Scripts/compiled/main.js"></script> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Telefilm { | |
title : string; | |
description: string; | |
characters: Character[]; | |
constructor( title: string, description: string, characters: Character[]) { | |
this.title= title; | |
this.description= description; | |
this.characters= characters; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <reference path="Ticket.ts"/> | |
class Vehicle { | |
private _brand: string; | |
private _height: number; | |
private _weight: number; | |
private _license_plate: string; | |
private _isParked: boolean; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <reference path="Vehicle.ts"/> | |
class Car extends Vehicle { | |
private _car_insurance: string; | |
private _license_plate: string; | |
constructor(brand: string, height: number, weight: number, car_insurance: string, license_plate: string) { | |
super(brand, height, weight); | |
this._car_insurance = car_insurance; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Ticket { | |
private _id: string; | |
private _enterDate: Date; | |
private _exitDate: Date; | |
constructor(parking_lot: string) { | |
this._id = parking_lot + "-" + ((new Date()).getTime().toString()); | |
this._enterDate = new Date(); //GET CURRENT DATE | |
this._exitDate = null; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <reference path="..\Vehicle.ts"/> | |
/// <reference path="Utils.ts"/> | |
/* | |
*Interface ParkingLot | |
*/ | |
interface ParkingLot<V, T> { | |
parkVehicle(vehicle: V): T; | |
exitVehicle(ticket: T): V; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "blog-tdd-using-mocha", | |
"version": "0.1.0", | |
"contributors": [ | |
{ | |
"name": "Samuele Resca" | |
} | |
], | |
"devDependencies": { | |
"chai": "^1.10.0", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
*SIMPLE CLASS: describes telefilms | |
*/ | |
var Telefilm = function (name, characters) { | |
this.name = name; | |
this.characters = characters; | |
}; | |
Telefilm.prototype.getName = function () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//FIX to the error : "expect is not defined" | |
var expect = chai.expect; | |
//describe Telefilm tests | |
describe('Telefilm', function() { | |
//Before the execution, initialize the object | |
before(function() { | |
this.telefilm = new Telefilm("Scrubs", ["John Dorian"]); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<meta charset="utf-8"> | |
<link rel="stylesheet" href="../node_modules/grunt-blanket-mocha/node_modules/mocha/mocha.css"> | |
<div id="mocha"><!--CONTENT OF TEST RESULTS --></div> | |
<div id="test" style="position: fixed; top: 0; left: -99999px;"> | |
</div> | |
<!-- Testing dependencies --> | |
<script src="../node_modules/chai/chai.js"></script> | |
<script src="../node_modules/sinon-chai/lib/sinon-chai.js"></script> | |
<script src="../node_modules/sinon/pkg/sinon.js"></script> |