Exemplo n.º 1
0
        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$"));
            }
        }
Exemplo n.º 2
0
        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");
            }
        }