I'm developing an application which test if SharePoint is installed correctly, with
stsadm and PowerShell access.
I wonder if there is a specified
stsadm or PowerShell command or a specified C# code I can use?
Windows Registry is probably the most reliable way to detect if SharePoint installed (Visual Studio uses this technique).
Please follow the article How To: Detect the Installed SKU of SharePoint 2010 for more details. It contains code sample that demonstrates how to retrieve the registry key of the installed SKU of SharePoint Server 2010.
This PowerShell function returns a hash table to the pipeline containing SharePoint 2010 or 2013 products and the SharePoint Build Version installed on your server.
This function has been verified to work with:
All SharePoint 2010 and 2013 versions