Created
August 26, 2012 06:10
-
-
Save smallgeek/3474864 to your computer and use it in GitHub Desktop.
NaturalSpec_Tutorial_3_2
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
namespace CarSellingLib | |
{ | |
public enum CarType | |
{ | |
BMW | |
} | |
} | |
namespace CarSellingLib | |
{ | |
public class Car | |
{ | |
public Car(CarType type, int horsePower) | |
{ | |
Type = type; | |
HorsePower = horsePower; | |
} | |
public CarType Type { get; set; } | |
public int HorsePower { get; set; } | |
public override string ToString() | |
{ | |
return string.Format("{0} ({1} HP)", Type, HorsePower); | |
} | |
public override bool Equals(object obj) | |
{ | |
var y = obj as Car; | |
if(y == null) return false; | |
return Type == y.Type && HorsePower == y.HorsePower; | |
} | |
} | |
} | |
using System; | |
namespace CarSellingLib | |
{ | |
public class Dealer | |
{ | |
public Dealer(string name) | |
{ | |
Name = name; | |
} | |
public string Name { get; set; } | |
public Car SellCar(int amount) | |
{ | |
return new Car(CarType.BMW, 200); | |
} | |
public override string ToString() | |
{ | |
return Name; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment