private void ValidateLegacyRuntimeInfo(WebAppDeploymentKind deploymentKind, RuntimeInfo runtimeInfo, string templateVersion)
        {
            var cacheAssemblies   = new HashSet <string>(File.ReadAllLines(Asset($"DotNetCache.{deploymentKind}.{templateVersion}.txt")), StringComparer.InvariantCultureIgnoreCase);
            var modulesNotInCache = new List <string>();

            foreach (var runtimeInfoModule in runtimeInfo.Modules)
            {
                // Skip native
                if (runtimeInfoModule.Version == null)
                {
                    continue;
                }


                // Check if assembly that is in the cache is loaded from it
                var moduleName = Path.GetFileNameWithoutExtension(runtimeInfoModule.ModuleName);
                if (cacheAssemblies.Contains(moduleName))
                {
                    if (runtimeInfoModule.FileName.IndexOf("\\DotNetCache\\x86\\", StringComparison.CurrentCultureIgnoreCase) == -1)
                    {
                        modulesNotInCache.Add(moduleName);
                    }
                    continue;
                }
            }

            Assert.Empty(modulesNotInCache);
        }
        private void ValidateStoreRuntimeInfo(RuntimeInfo runtimeInfo, string dotnetPath)
        {
            var storeModules   = PathUtilities.GetStoreModules(dotnetPath);
            var runtimeModules = PathUtilities.GetLatestSharedRuntimeAssemblies(dotnetPath, out var runtimeVersion);

            foreach (var runtimeInfoModule in runtimeInfo.Modules)
            {
                // Skip native
                if (runtimeInfoModule.Version == null)
                {
                    continue;
                }

                var moduleName = Path.GetFileNameWithoutExtension(runtimeInfoModule.ModuleName);

                // Check if module should come from the store, verify that one of the expected versions is loaded
                var storeModule = storeModules.SingleOrDefault(f => moduleName.Equals(f.Name, StringComparison.InvariantCultureIgnoreCase));
                if (storeModule != null)
                {
                    var expectedVersion = false;
                    foreach (var version in storeModule.Versions)
                    {
                        var expectedModulePath = $"store\\x86\\netcoreapp2.0\\{storeModule.Name}\\{version}";

                        if (runtimeInfoModule.FileName.IndexOf(expectedModulePath, StringComparison.InvariantCultureIgnoreCase) != -1)
                        {
                            expectedVersion = true;
                            break;
                        }
                    }

                    Assert.True(expectedVersion, $"{runtimeInfoModule.FileName} doesn't match expected versions: {string.Join(",", storeModule.Versions)}");
                }

                // Verify that modules that we expect to come from runtime actually come from there
                // Native modules would prefer to be loaded from windows folder, skip them
                if (runtimeModules.Any(rutimeModule => runtimeInfoModule.ModuleName.Equals(rutimeModule, StringComparison.InvariantCultureIgnoreCase)))
                {
                    Assert.Contains($"shared\\Microsoft.NETCore.App\\{runtimeVersion}", runtimeInfoModule.FileName);
                }
            }
        }