Esempio n. 1
0
        public void GenerateGetQuery_NoPrimaryKey_Valid()
        {
            // Arrange
            var generator = new MySqlQueryGenerator <HeapEntity>("Users");

            // Act
            var query = generator.GenerateGetQuery();

            // Assert
            Assert.Equal("SELECT Users.Username, Users.Password FROM Users WHERE Users.Username = @Username AND Users.Password = @Password;", query);
        }
Esempio n. 2
0
        public void GenerateGetQuery_CompositePrimaryKey_Valid()
        {
            // Arrange
            var generator = new MySqlQueryGenerator <CompositePrimaryKeyEntity>("Users");

            // Act
            var selectQuery = generator.GenerateGetQuery();

            // Assert
            Assert.Equal($"SELECT Users.Username, Users.Password, Users.DateCreated FROM Users WHERE Users.Username = @Username AND Users.Password = @Password;", selectQuery);
        }
Esempio n. 3
0
        public void GenerateGetQuery_CustomColumnNames_Valid()
        {
            // Arrange
            var generator = new MySqlQueryGenerator <CustomColumnNamesEntity>("Orders");

            // Act
            var selectQuery = generator.GenerateGetQuery();

            // Assert
            Assert.Equal($"SELECT Orders.OrderId AS Id, Orders.DateCreated AS Date FROM Orders WHERE Orders.OrderId = @Id;", selectQuery);
        }
Esempio n. 4
0
        public void GenerateGetQuery_SinglePrimaryKey_Valid()
        {
            // Arrange
            var generator = new MySqlQueryGenerator <SinglePrimaryKeyEntity>("Users");

            // Act
            var selectQuery = generator.GenerateGetQuery();

            // Assert
            Assert.Equal($"SELECT Users.Id, Users.Username, Users.Password FROM Users WHERE Users.Id = @Id;", selectQuery);
        }