public void EnsureIsManagedServiceAccount_ThrowsExceptionDuringCheck() { using (TestHostContext tc = new TestHostContext(this, "EnsureIsManagedServiceAccount_TrueForManagedAccount")) { Tracing trace = tc.GetTrace(); trace.Info("Creating an instance of the MockNativeWindowsServiceHelper class"); var windowsServiceHelper = new MockNativeWindowsServiceHelper(); windowsServiceHelper.ShouldErrorHappenDuringManagedServiceAccoutCheck = true; Assert.Throws <Win32Exception>(() => windowsServiceHelper.IsManagedServiceAccount("managedServiceAccount$")); } }
public void EnsureIsManagedServiceAccount_FalseForNonManagedAccount() { using (TestHostContext tc = new TestHostContext(this, "EnsureIsManagedServiceAccount_TrueForManagedAccount")) { Tracing trace = tc.GetTrace(); trace.Info("Creating an instance of the MockNativeWindowsServiceHelper class"); var windowsServiceHelper = new MockNativeWindowsServiceHelper(); windowsServiceHelper.ShouldAccountBeManagedService = false; var isManagedServiceAccount = windowsServiceHelper.IsManagedServiceAccount("managedServiceAccount$"); Assert.True(!isManagedServiceAccount, "Account should be properly determined as not managed service"); } }