Testing Hardy-Weinberg equilibrium (HWE) in the control group is commonly used to detect genotyping errors in genetic association studies. We propose a likelihood ratio test for testing HWE in the study population using both case and control samples. This test incorporates underlying association models. Another feature is that, when we infer the disease-genotype association, we explicitly incorporate HWE or a possible departure from Hardy-Weinberg equilibrium (DHWE) into the model. Our unified framework enables us to infer the disease-genotype association when a detected DHWE needs to be part of the model after causes for the DHWE are explored. Real data sets are used to illustrate the application of the methodology and its implication in genetic association studies. Our analysis and interpretation touch on issues such as genotyping errors, population selection, population stratification, or the study sampling plan, that all could be the cause of DHWE.