Esempio n. 1
0
        public void IntegrationTestDuplicates()
        {
            SqlConnection sqlConn = new SqlConnection("Server=titan.cs.rose-hulman.edu;Database=csse376_36;User Id=csse376;Password=csse376;");
            sqlConn.Open();
            ExecuteSQLFile("EmptyAllTables.sql", sqlConn);

            Hotel h1 = new Hotel(3);
            Assert.IsFalse(h1.IsAlreadyInDB(sqlConn));
            h1.WriteToDB(sqlConn);
            Hotel h2 = new Hotel(3);
            Assert.IsTrue(h2.IsAlreadyInDB(sqlConn));

            Car c1 = new Car(1);
            Assert.IsFalse(c1.IsAlreadyInDB(sqlConn));
            c1.WriteToDB(sqlConn);
            Car c2 = new Car(1);
            Assert.IsTrue(c2.IsAlreadyInDB(sqlConn));

            Flight f1 = new Flight(Flight.FromUnixTime(1401283755), Flight.FromUnixTime(1401944806), 2939);
            Assert.IsFalse(f1.IsAlreadyInDB(sqlConn));
            f1.WriteToDB(sqlConn);
            Flight f2 = new Flight(Flight.FromUnixTime(1401283755), Flight.FromUnixTime(1401944806), 2939);
            Assert.IsTrue(f2.IsAlreadyInDB(sqlConn));
        }