public void readTokenAtEntryTestBasicTrain() { sc.updateAccountBalance(10); var reader = new DigitalReader("Train", "Victoria"); Assert.AreEqual(true, reader.readTokenAtEntry(sc.getID())); }
public void readTokenAtEntryTestInvalidId() { var reader = new DigitalReader("Bus", "Victoria"); Assert.AreEqual(false, reader.readTokenAtEntry(-999999)); Assert.AreEqual(false, reader.readTokenAtEntry(999999)); }
public void getReaderTypeTestBasic() { var reader = new DigitalReader("Bus", "Victoria"); var anotherReader = new DigitalReader("Train", "Victoria"); Assert.AreEqual("Bus", reader.getReaderType()); Assert.AreEqual("Train", anotherReader.getReaderType()); }
public void readTokenAtExitTestSameStopNoCharge() { sc.updateAccountBalance(10); var reader = new DigitalReader("Train", "Victoria"); reader.setLocation(RailMap.Instance.getLocation("Baker Street")); reader.readTokenAtEntry(sc.getID()); float expectedBalance = ac.getBalance(); Assert.AreEqual(expectedBalance, reader.readTokenAtExit(sc.getID(), "Circle")); }
public void readTokenAtExitTestBasic() { sc.updateAccountBalance(10); var reader = new DigitalReader("Train", "Victoria"); reader.setLocation(RailMap.Instance.getLocation("Baker Street")); reader.readTokenAtEntry(sc.getID()); reader.setLocation(RailMap.Instance.getLocation("Great Portland Street")); float expectedBalance = ac.getBalance() - FareRules.Instance.getCostPerStation(); Assert.AreEqual(expectedBalance, reader.readTokenAtExit(sc.getID(), "Circle")); }
public void readTokenAtExitInsufficientFunds() { sc2.updateAccountBalance(5); var reader = new DigitalReader("Train", "Victoria"); reader.setLocation(RailMap.Instance.getLocation("Baker Street")); reader.readTokenAtEntry(sc2.getID()); reader.setLocation(RailMap.Instance.getLocation("Victoria")); float expectedResult = -1f; Assert.AreEqual(expectedResult, reader.readTokenAtExit(sc2.getID(), "Circle")); }
public void readTokenAtExitTestMultipleLines() { var reader = new DigitalReader("Bus", "Victoria"); sc.updateAccountBalance(50); float expected = sc.getAccount().getBalance() - (FareRules.Instance.getCostPerStation() * 2); reader.setLocation(RailMap.Instance.getLocation("Westminster")); reader.readTokenAtEntry(sc.getID()); reader.setLocation(RailMap.Instance.getLocation("Pimlico")); float actual = reader.readTokenAtExit(sc.getID(), "Victoria"); Assert.AreEqual(expected, actual); }
public void readTokenAtExitTestDayPassOneTrip() { var reader = new DigitalReader("Bus", "Victoria"); sc.updateAccountBalance(50); float dpCost = FareRules.Instance.getDayPassCost(); float expected = sc.getAccount().getBalance() - dpCost; reader.setLocation(RailMap.Instance.getLocation("Edgware Road")); reader.readTokenAtEntry(sc.getID()); reader.setLocation(RailMap.Instance.getLocation("Victoria")); float actual = reader.readTokenAtExit(sc.getID(), "Circle"); Assert.AreEqual(expected, actual); }
private void btnEnterGate_Click(object sender, EventArgs e) { DigitalReader currentReader = new DigitalReader("Bus", this.start); tokenId = (int)cbxTokens.SelectedValue; if (currentReader.readTokenAtEntry(tokenId)) { MessageBox.Show("Gate Open"); new frmRailTravelSim(start, tokenId).Show(); this.Hide(); } else { MessageBox.Show("Invalid Entry Token/Insufficient Funds"); } }
private void btnExitGate_Click(object sender, EventArgs e) { float currentBalance = 0; DigitalReader currentReader = new DigitalReader("Bus", currentLocation); try { currentBalance = currentReader.readTokenAtExit(tokenId, currentLine);// to return float if (currentBalance < 0) { MessageBox.Show("Invalid Token/Insufficient funds"); } else if (currentBalance >= 0) { MessageBox.Show("Remaining Balance: " + currentBalance); this.Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void readTokenAtExitTestAnotherInvalidId() { var reader = new DigitalReader("Bus", "Victoria"); reader.readTokenAtExit(999999, "Circle"); }
public void digitalReaderConstructionTestInvalidType() { var reader = new DigitalReader("Waffle Iron", "Victoria"); }
public void getDateTestBasic() { var reader = new DigitalReader("Bus", "Victoria"); Assert.AreEqual(DateTime.Now.ToString("yyyy-MM-dd"), reader.getDay().ToString("yyyy-MM-dd")); }
public void readTokenAtEntryTestInsufficientFunds() { var reader = new DigitalReader("Bus", "Victoria"); Assert.AreEqual(false, reader.readTokenAtEntry(sc2.getID())); }
public void readTokenAtExitTestNoEntryScan() { var reader = new DigitalReader("Train", "Victoria"); reader.readTokenAtExit(sc.getID(), "Circle"); }
public void digitalReaderConstructionTestAnotherInvalidType() { var reader = new DigitalReader("All of the bees", "Victoria"); }
public void digitalReaderConstructionNullType() { var reader = new DigitalReader(null, "Victoria"); }