Exemplo n.º 1
0
 public void Initialize()
 {
     new DataBaseOperations();
     DataBaseOperations.ConnectToDB();
     s_connection = DataBaseOperations.Connection;
     TT           = new TerritoryTable();
 }
Exemplo n.º 2
0
        public void TestRetrieveNumberOfColsInTableMethodShouldReturnIntNotNUll()
        {
            //Arrange
            var sut = new TerritoryTable();

            //Act
            int numberReturned = sut.RetriveNumberOfColsInTable();

            //Assert
            Assert.IsNotNull(numberReturned);
        }
Exemplo n.º 3
0
        public void TestTableExistsMethodToSeeIfAKnownTableExists()
        {
            // Arrange
            var sut = new TerritoryTable();

            // Act
            bool tableExists = sut.TableExists(sut.TableName);
            bool expected    = true;
            bool actual      = tableExists;

            //Assert
            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 4
0
        public void TestToSeeIfRowIsDeleted()
        {
            // Arrange
            int    count = 1;
            var    sut   = new TerritoryTable();
            String territoryIndexString = "This is territoryIndex1";
            String sqlString            = "DELETE FROM Territories WHERE territoryIndex='" + territoryIndexString + "';";

            // Act
            TT.DeleteRowFromTable(territoryIndexString);
            SqlCommand    command  = new SqlCommand(sqlString, s_connection);
            SqlDataReader myReader = command.ExecuteReader();

            while (myReader.Read())
            {
                count++;
            }

            // Assert
            Assert.AreEqual(1, count);
        }