コード例 #1
0
 public void TestTramOnRail()
 {
     Rail rail = new Rail(1, true, false, 1, "Combino");
     User user = new User(2323, "test", "test", 1);
     Tram tram = new Tram(1, "test", rail, user, 1, false);
     tram.OnRail = true;
     Assert.AreEqual(true, tram.OnRail, "Tram on rail");
 }
コード例 #2
0
ファイル: Tram.cs プロジェクト: marouanopen/ICT4RealsWebForms
 /// <summary>
 /// Creation of a new tram
 /// </summary>
 /// <param name="id">id of the tram</param>
 /// <param name="type">tram type</param>
 /// <param name="rail">rail on which the tram should be placed on</param>
 /// <param name="driver">the driver of the tram</param>
 /// <param name="status">1= OK 2= Dirty 3= Defect 4= DirtyAndDefect</param>
 public Tram(int id, string type, Rail rail, User driver, int status, bool onRail)
 {
     this.Id = id;
     this.Type = type;
     this.Rail = rail;
     this.Driver = driver;
     Status = (Status)status;
     OnRail = onRail;
 }
コード例 #3
0
 public void TestMoveTram()
 {
     Rail rail = new Rail(1, true, false, 1, "Combino");
     Rail rail2 = new Rail(2, true, false, 1, "Combino");
     User user = new User(2323, "test", "test", 1);
     Tram tram = new Tram(1, "test", rail, user, 1, true);/*
     tram.AddTram(1, 1, 1, 1);
     tram.MoveTram(2, 1, 1);
     Assert.AreEqual(2, rail2.Id, "rail 2");*/
     Assert.AreEqual(1,1);
 }
コード例 #4
0
 public void TestTramProperties()
 {
     Rail rail = new Rail(1, true, false, 1, "Combino");
     User user = new User(2323, "test", "test", 1);
     Tram tram = new Tram(1, "test", rail, user, 1, true);
     Assert.AreEqual(tram.Id, 1, "TramID");
     Assert.AreEqual(tram.Type, "test", "tramID");
     Assert.AreEqual(tram.Rail, rail, "tram rail");
     Assert.AreEqual(tram.Driver, user, "tram driver");
     Assert.AreEqual(tram.OnRail, true, "tram onrail");
     Assert.AreEqual(tram._Status, 1, "tram status");
 }
コード例 #5
0
 /// <summary>
 /// logs the user in
 /// </summary>
 /// <param name="username">username of the user</param>
 /// <param name="password">matching password</param>
 /// <returns>bool indicating succes</returns>
 public bool LogIn(string username, string password)
 {
     foreach (Dictionary<string, object> D in addatabase.Getuserpassword(username))
     {
         if ((string)D["wachtwoord"] == password)
         {
             LoggedInUser = new User(Convert.ToInt32(D["gebruikerid"]), (string)D["naam"], (string)D["email"], Convert.ToInt32(D["functieid"]));
             return true;
         }
     }
     return false;
 }