Ejemplo n.º 1
0
        public void ClearHotReloadEnvironmentVariables_ClearsStartupHook()
        {
            // Arrange
            var environmentVariables = new Dictionary <string, string?>
            {
                ["DOTNET_MODIFIABLE_ASSEMBLIES"] = "debug",
                ["DOTNET_STARTUP_HOOKS"]         = typeof(StartupHook).Assembly.Location
            };

            // Act
            StartupHook.ClearHotReloadEnvironmentVariables(
                (name) => environmentVariables[name],
                (name, value) => environmentVariables[name] = value);

            // Assert
            Assert.Empty(environmentVariables["DOTNET_STARTUP_HOOKS"]);
        }
Ejemplo n.º 2
0
        public void ClearHotReloadEnvironmentVariables_RemovesHotReloadStartup_InCaseInvariantManner()
        {
            // Arrange
            var customStartupHook    = "/path/mycoolstartup.dll";
            var environmentVariables = new Dictionary <string, string?>
            {
                ["DOTNET_MODIFIABLE_ASSEMBLIES"] = "debug",
                ["DOTNET_STARTUP_HOOKS"]         = customStartupHook + Path.PathSeparator + typeof(StartupHook).Assembly.Location.ToUpperInvariant(),
            };

            // Act
            StartupHook.ClearHotReloadEnvironmentVariables(
                (name) => environmentVariables[name],
                (name, value) => environmentVariables[name] = value);

            // Assert
            Assert.Equal(customStartupHook, environmentVariables["DOTNET_STARTUP_HOOKS"]);
        }
Ejemplo n.º 3
0
        public void ClearHotReloadEnvironmentVariables_PreservedOtherStartupHooks()
        {
            // Arrange
            var customStartupHook    = "/path/mycoolstartup.dll";
            var environmentVariables = new Dictionary <string, string?>
            {
                ["DOTNET_MODIFIABLE_ASSEMBLIES"] = "debug",
                ["DOTNET_STARTUP_HOOKS"]         = typeof(StartupHook).Assembly.Location + Path.PathSeparator + customStartupHook,
            };

            // Act
            StartupHook.ClearHotReloadEnvironmentVariables(
                (name) => environmentVariables[name],
                (name, value) => environmentVariables[name] = value);

            // Assert
            Assert.Equal(customStartupHook, environmentVariables["DOTNET_STARTUP_HOOKS"]);
        }