public void getTypeTest() { seatType expected = seatType.dress; seatType actual = testSeat.getType(); Assert.AreEqual(expected, actual); }
public Seat stringToSeat(string typerowcolumnprice) // in the form "Type:ColumnRow:Price:Reserved" { string[] split = typerowcolumnprice.Split(':'); if (split.Length == 1) { goto emptySeat; } if (split.Length != 4) { throw new ArgumentOutOfRangeException(); } seatType type = stringToType(split[0]); char row = split[1][0]; split[1] = split[1].Substring(1); int column = int.Parse(split[1]); float price = float.Parse(split[2]); bool res; if (split[3].ToLower() == "true") { res = true; } else { res = false; } return(new Seat(row, column, type, price, res)); emptySeat: return(new Seat()); }
public Seat(char pRow, int pColumn, seatType pType, float pPrice, bool pReserved) { row = pRow; column = pColumn; type = pType; price = pPrice; reserved = pReserved; }
public Seat(char pRow, int pColumn, seatType pType, float pPrice) { row = pRow; column = pColumn; type = pType; price = pPrice; reserved = false; }
public static Seats seatFactory(seatType type) { switch (type) { case seatType.FirstClass: return(new FirstClass()); case seatType.SecondClass: return(new SecondClass()); default: return(null); } }
public static SeatInterface seatFactory(seatType type, int seatNumber, double price, bool sold) { switch (type) { case seatType.firstClassWindow: return(new FirstClassWindowSeat(seatNumber, price, sold)); case seatType.firstClassAlis: return(new FirstClassAisleSeat(seatNumber, price, sold)); case seatType.secondClassWindow: return(new SecondClassWindowSeat(seatNumber, price, sold)); case seatType.secondClassAlis: return(new SecondClassAisleSeat(seatNumber, price, sold)); default: return(null); } }