using System; using System.Runtime.InteropServices; using FILETIME = System.Runtime.InteropServices.ComTypes.FILETIME; namespace VisualStudioMock { public class SetupInstance : ISetupInstance, ISetupInstance2, ISetupPropertyStore { #region ISetupInstance Members public string GetDescription([In, MarshalAs(UnmanagedType.U4)] int lcid = 0) { Ext.LogCall(nameof(SetupInstance), nameof(GetDescription)); return "description"; } public string GetDisplayName([In, MarshalAs(UnmanagedType.U4)] int lcid = 0) { Ext.LogCall(nameof(SetupInstance), nameof(GetDisplayName), "Lcid = " + lcid.ToString()); return "Visual Studio Community 2026"; } public string GetInstallationName() { Ext.LogCall(nameof(SetupInstance), nameof(GetInstallationName)); return "installation name"; } public string GetInstallationPath() { Ext.LogCall(nameof(SetupInstance), nameof(GetInstallationPath)); return @"C:\Program Files\Microsoft Visual Studio\18\Community"; } public string GetInstallationVersion() { Ext.LogCall(nameof(SetupInstance), nameof(GetInstallationVersion)); return "18.0.333.805"; } public FILETIME GetInstallDate() { Ext.LogCall(nameof(SetupInstance), nameof(GetInstallDate)); throw new NotImplementedException(); } public string GetInstanceId() { Ext.LogCall(nameof(SetupInstance), nameof(GetInstanceId)); return "id1"; } public string ResolvePath([In, MarshalAs(UnmanagedType.LPWStr)] string pwszRelativePath = null) { Ext.LogCall(nameof(SetupInstance), nameof(ResolvePath)); throw new NotImplementedException(); } #endregion #region ISetupInstance2 Members public string GetEnginePath() { Ext.LogCall(nameof(SetupInstance), nameof(GetEnginePath)); return @"C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service"; } public ISetupErrorState GetErrors() { Ext.LogCall(nameof(SetupInstance), nameof(GetEnginePath)); throw new NotImplementedException(); } public ISetupPackageReference[] GetPackages() { Ext.LogCall(nameof(SetupInstance), nameof(GetEnginePath)); throw new NotImplementedException(); } public ISetupPackageReference GetProduct() { Ext.LogCall(nameof(SetupInstance), nameof(GetEnginePath)); throw new NotImplementedException(); } public string GetProductPath() { Ext.LogCall(nameof(SetupInstance), nameof(GetEnginePath)); throw new NotImplementedException(); } public ISetupPropertyStore GetProperties() { Ext.LogCall(nameof(SetupInstance), nameof(GetProperties)); return this; } public InstanceState GetState() { Ext.LogCall(nameof(SetupInstance), nameof(GetState)); return InstanceState.Complete; } public bool IsComplete() { Ext.LogCall(nameof(SetupInstance), nameof(IsComplete)); return true; } public bool IsLaunchable() { Ext.LogCall(nameof(SetupInstance), nameof(IsLaunchable)); return true; } #endregion #region ISetupPropertyStore Members public string[] GetNames() { Ext.LogCall(nameof(SetupInstance), nameof(GetNames)); throw new NotImplementedException(); } public object GetValue(string pwszName) { Ext.LogCall(nameof(SetupInstance), nameof(GetValue)); throw new NotImplementedException(); } #endregion } }