Ejemplo n.º 1
0
        public void IsUACEnabledOnOldWindows_ReturnsNotSupported()
        {
            // Create a key that doesn't exist as in Windows XP and 2003
            OSCollectorHelper.uacKeyName = "EnableLUA_";
            string expected = "UAC is not supported for this OS";
            string actual   = OSCollectorHelper.UACInfo();

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 2
0
        public void GetKRBContentFromEnvVar_ReturnsFileNotFound()
        {
            string path = @"c:\windows\krb5_stupid_name_that_dont_exist.ini";

            Environment.SetEnvironmentVariable("KRB5_CONFIG", path);

            string content = OSCollectorHelper.GetKerberosConfiguration();
            bool   actual  = content.Contains("File not found");

            Assert.AreEqual(true, actual);
        }
Ejemplo n.º 3
0
        public void GetKRBContentFromFile_ReturnsContent()
        {
            // Create the file c:\windows\krb5.ini
            string path = @"c:\windows\krb5.ini";

            //Write some content in file
            CreateKrbFile(path);

            string content = OSCollectorHelper.GetKerberosConfiguration();
            bool   actual  = content.Contains("[libdefaults]");

            // Delete the file if it exists.
            DeleteKrbFile(path);

            Assert.AreEqual(true, actual);
        }
Ejemplo n.º 4
0
        public void GetKRBContentFromEnvVar_ReturnsContent()
        {
            // Create the file c:\windows\krb5.ini
            string path = @"c:\windows\krb5.ini";

            //Write some content in file
            CreateKrbFile(path);

            // Create the Env variable %krb5_config%
            Environment.SetEnvironmentVariable("KRB5_CONFIG", path);

            string content = OSCollectorHelper.GetKerberosConfiguration();
            bool   actual  = content.Contains("[libdefaults]");

            DeleteKrbFile(path);
            // Delete the environment variable
            Environment.SetEnvironmentVariable("KRB5_CONFIG", "");

            Assert.AreEqual(true, actual);
        }
Ejemplo n.º 5
0
        public void GetKRBContentFromFile_ReturnsNothing()
        {
            string path    = @"c:\windows\krb5.ini";
            string newPath = @"c:\windows\krb5_.ini";

            // If the krb5.ini file exists, rename it so we don't find it
            if (File.Exists(path))
            {
                File.Move(path, newPath);
            }

            string content = OSCollectorHelper.GetKerberosConfiguration();
            bool   actual  = content.Contains("Not detected");

            // If the file was renamed, revert back to the original name
            if (File.Exists(newPath))
            {
                File.Move(newPath, path);
            }

            Assert.AreEqual(true, actual);
        }