Exemplo 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);
        }
Exemplo 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);
        }
Exemplo 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);
        }
Exemplo 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);
        }