public static void TryGetEnvironmentVariableT_GivenExistingVariableAndIncorrectType_ReturnsFalseAndDefaultValue()
        {
            var env = new EnvironmentVariableProvider();

            var isFound = env.TryGetEnvironmentVariable <int>("PATH", out var pathInt);

            Assert.IsFalse(isFound);
            Assert.AreEqual(default(int), pathInt);
        }
        public static void TryGetEnvironmentVariableTWithFormatter_GivenMissingVariable_ReturnsFalseAndDefaultValue()
        {
            var env = new EnvironmentVariableProvider();

            var isFound = env.TryGetEnvironmentVariable <int>("THIS_WILL_NOT_BE_FOUND", null, out var notFoundVar);

            Assert.Multiple(() =>
            {
                Assert.IsFalse(isFound);
                Assert.AreEqual(default(int), notFoundVar);
            });
        }
        public static void TryGetEnvironmentVariable_GivenExistingVariable_ReturnsTrueAndCorrectValue()
        {
            var env = new EnvironmentVariableProvider();

            var isFound = env.TryGetEnvironmentVariable("PATH", out var providerPath);
            var sysPath = Environment.GetEnvironmentVariable("PATH");

            Assert.Multiple(() =>
            {
                Assert.IsTrue(isFound);
                Assert.AreEqual(sysPath, providerPath);
            });
        }
        public static void TryGetEnvironmentVariable_GivenMissingVariable_ReturnsFalseAndNullValue()
        {
            var env = new EnvironmentVariableProvider();

            var isFound = env.TryGetEnvironmentVariable("THIS_WILL_NOT_BE_FOUND", out var notFoundVar);

            _ = Environment.GetEnvironmentVariable("THIS_WILL_NOT_BE_FOUND");

            Assert.Multiple(() =>
            {
                Assert.IsFalse(isFound);
                Assert.IsNull(notFoundVar);
            });
        }
        public static void TryGetEnvironmentVariableT_GivenExistingVariableAndCorrectType_ReturnsTrueAndCorrectValue()
        {
            var env = new EnvironmentVariableProvider();

            // note that this will probably only work on Windows
            var isFound          = env.TryGetEnvironmentVariable <int>("NUMBER_OF_PROCESSORS", out var numberOfProcessors);
            var sysNumberOfProcs = Environment.GetEnvironmentVariable("NUMBER_OF_PROCESSORS");

            Assert.Multiple(() =>
            {
                Assert.IsTrue(isFound);
                Assert.IsTrue(numberOfProcessors > 0);
                Assert.AreEqual(sysNumberOfProcs, numberOfProcessors.ToString());
            });
        }