public void GenerationIsCorrect()
        {
            this.SetupTest("ServicesDependenciesPlatforms");

            this.Generate("Windows");

            _assert.True(File.Exists(this.GetPath(@"Console\Console.Windows.csproj")));
            _assert.True(File.Exists(this.GetPath(@"Module.Windows.sln")));
            _assert.True(File.Exists(this.GetPath(@"Submodule\Library\Library.Windows.csproj")));
            _assert.True(File.Exists(this.GetPath(@"Submodule\Submodule.Windows.sln")));

            var moduleContents    = this.ReadFile(@"Module.Windows.sln");
            var submoduleContents = this.ReadFile(@"Submodule\Submodule.Windows.sln");

            _assert.Contains("Console.Windows.csproj", moduleContents);
            _assert.Contains("Library.Windows.csproj", moduleContents);
            _assert.Contains("Library.Windows.csproj", submoduleContents);

            this.Generate("Linux");

            _assert.True(File.Exists(this.GetPath(@"Console\Console.Linux.csproj")));
            _assert.True(File.Exists(this.GetPath(@"Module.Linux.sln")));
            _assert.False(File.Exists(this.GetPath(@"Submodule\Library\Library.Linux.csproj")));
            _assert.True(File.Exists(this.GetPath(@"Submodule\Submodule.Linux.sln")));

            moduleContents    = this.ReadFile(@"Module.Linux.sln");
            submoduleContents = this.ReadFile(@"Submodule\Submodule.Linux.sln");

            _assert.Contains("Console.Linux.csproj", moduleContents);
            _assert.DoesNotContain("Library.Linux.csproj", moduleContents);
            _assert.DoesNotContain("Library.Linux.csproj", submoduleContents);
        }
        public void GenerationIsCorrect()
        {
            this.SetupTest("ServicesExternalProjects");

            this.Generate(platform: "Windows");

            _assert.True(File.Exists(this.GetPath(@"Console\Console.Windows.csproj")));

            var consoleContents = this.ReadFile(@"Console\Console.Windows.csproj");

            _assert.Contains("RefGACNoPlatform", consoleContents);
            _assert.Contains("RefBinaryNoPlatform", consoleContents);
            _assert.Contains("RefProjectNoPlatform", consoleContents);
            _assert.Contains("RefProtobuildNoPlatform", consoleContents);
            _assert.Contains("RefGACPlatform", consoleContents);
            _assert.Contains("RefBinaryPlatform", consoleContents);
            _assert.Contains("RefProjectPlatform", consoleContents);
            _assert.Contains("RefProtobuildPlatform", consoleContents);

            this.Generate(platform: "Linux");

            _assert.True(File.Exists(this.GetPath(@"Console\Console.Linux.csproj")));

            consoleContents = this.ReadFile(@"Console\Console.Linux.csproj");

            _assert.Contains("RefGACNoPlatform", consoleContents);
            _assert.Contains("RefBinaryNoPlatform", consoleContents);
            _assert.Contains("RefProjectNoPlatform", consoleContents);
            _assert.Contains("RefProtobuildNoPlatform", consoleContents);
            _assert.DoesNotContain("RefGACPlatform", consoleContents);
            _assert.DoesNotContain("RefBinaryPlatform", consoleContents);
            _assert.DoesNotContain("RefProjectPlatform", consoleContents);
            _assert.DoesNotContain("RefProtobuildPlatform", consoleContents);
        }
Esempio n. 3
0
        public void GenerationIsCorrect()
        {
            this.SetupTest("ServicesEnable");

            this.Generate();

            _assert.True(File.Exists(this.GetPath(@"Console\Console.Windows.csproj")));
            _assert.False(File.Exists(this.GetPath(@"Submodule\Library\Library.Windows.csproj")));

            var consoleContents = this.ReadFile(@"Console\Console.Windows.csproj");

            _assert.DoesNotContain("CONSOLE_SERVICE_A;", consoleContents);

            this.Generate(args: "--enable Console/ServiceA");

            _assert.True(File.Exists(this.GetPath(@"Console\Console.Windows.csproj")));
            _assert.True(File.Exists(this.GetPath(@"Submodule\Library\Library.Windows.csproj")));

            consoleContents = this.ReadFile(@"Console\Console.Windows.csproj");
            var libraryContents = this.ReadFile(@"Submodule\Library\Library.Windows.csproj");

            _assert.Contains("CONSOLE_SERVICE_A;", consoleContents);
            _assert.Contains("LIBRARY_SERVICE_B;", libraryContents);

            this.Generate(args: "--enable Library/ServiceB");

            _assert.True(File.Exists(this.GetPath(@"Console\Console.Windows.csproj")));
            _assert.True(File.Exists(this.GetPath(@"Submodule\Library\Library.Windows.csproj")));

            consoleContents = this.ReadFile(@"Console\Console.Windows.csproj");
            libraryContents = this.ReadFile(@"Submodule\Library\Library.Windows.csproj");

            _assert.DoesNotContain("CONSOLE_SERVICE_A;", consoleContents);
            _assert.Contains("LIBRARY_SERVICE_B;", libraryContents);
        }
        public void SyncIsCorrect()
        {
            this.SetupTest("SyncDoesNotIncludeContentExtensive");

            // Reset the definition back to it's original version for the test.
            var original = this.GetPath(@"Build\OriginalProjects\HMRQ.definition");
            var target   = this.GetPath(@"Build\Projects\HMRQ.definition");

            File.Copy(original, target, true);

            this.OtherMode("sync", "Windows", purge: false);

            var targetContents = this.ReadFile(@"Build\Projects\HMRQ.definition");

            try
            {
                _assert.Contains("Program.cs", targetContents);
                _assert.Contains("Furnace.cs", targetContents);
                _assert.DoesNotContain(@"..\HMRQ.Content\assets\.source", targetContents);
                _assert.DoesNotContain(@"..\HMRQ.Content\assets\audio\Jump.wav", targetContents);
            }
            finally
            {
                // Reset the file back after the test passes so that Git doesn't
                // report this file as changed.
                File.Copy(original, target, true);
            }
        }
        public void GenerationIsCorrect()
        {
            this.SetupTest("NativeBinaryPresent");

            this.Generate("Windows");

            _assert.True(File.Exists(this.GetPath(@"Module.Windows.sln")));
            _assert.True(File.Exists(this.GetPath(@"Console\Console.Windows.csproj")));

            var projectContents = this.ReadFile(@"Console\Console.Windows.csproj");

            _assert.Contains("<Link>All</Link>", projectContents);
            _assert.Contains("<Link>Windows.dll</Link>", projectContents);
            _assert.DoesNotContain("<Link>Linux.so</Link>", projectContents);
            _assert.Contains("<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>", projectContents);
            _assert.Contains(@"<None Include=""..\ThirdParty\All"">", projectContents);
            _assert.Contains(@"<None Include=""..\ThirdParty\Windows.dll"">", projectContents);
            _assert.DoesNotContain(@"<None Include=""..\ThirdParty\Linux.so"">", projectContents);

            this.Generate("Linux");

            _assert.True(File.Exists(this.GetPath(@"Module.Linux.sln")));
            _assert.True(File.Exists(this.GetPath(@"Console\Console.Linux.csproj")));

            projectContents = this.ReadFile(@"Console\Console.Linux.csproj");

            _assert.Contains("<Link>All</Link>", projectContents);
            _assert.DoesNotContain("<Link>Windows.dll</Link>", projectContents);
            _assert.Contains("<Link>Linux.so</Link>", projectContents);
            _assert.Contains("<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>", projectContents);
            _assert.Contains(@"<None Include=""..\ThirdParty\All"">", projectContents);
            _assert.DoesNotContain(@"<None Include=""..\ThirdParty\Windows.dll"">", projectContents);
            _assert.Contains(@"<None Include=""..\ThirdParty\Linux.so"">", projectContents);
        }
        public void GenerationIsCorrect()
        {
            this.SetupTest("ServicesRecommends");

            this.Generate();

            _assert.True(File.Exists(this.GetPath(@"Console\Console.Windows.csproj")));
            _assert.True(File.Exists(this.GetPath(@"Submodule\Library\Library.Windows.csproj")));

            var libraryContents = this.ReadFile(@"Submodule\Library\Library.Windows.csproj");

            _assert.Contains("LIBRARY_SERVICE_B;", libraryContents);

            /*
             * ServiceB is only recommended, so if we explicitly disable it, it should
             * not be present.
             */

            this.Generate(args: "--disable Library/ServiceB");

            _assert.True(File.Exists(this.GetPath(@"Console\Console.Windows.csproj")));
            _assert.True(File.Exists(this.GetPath(@"Submodule\Library\Library.Windows.csproj")));

            libraryContents = this.ReadFile(@"Submodule\Library\Library.Windows.csproj");

            _assert.DoesNotContain("LIBRARY_SERVICE_B;", libraryContents);

            /*
             * ServiceA conflicts with ServiceB, so ServiceB automatically gets disabled.
             */

            this.Generate(args: "--enable Library/ServiceA");

            _assert.True(File.Exists(this.GetPath(@"Console\Console.Windows.csproj")));
            _assert.True(File.Exists(this.GetPath(@"Submodule\Library\Library.Windows.csproj")));

            libraryContents = this.ReadFile(@"Submodule\Library\Library.Windows.csproj");

            _assert.DoesNotContain("LIBRARY_SERVICE_B;", libraryContents);

            /*
             * ServiceC has no effect on ServiceB, so ServiceB should be enabled.
             */

            this.Generate(args: "--enable Library/ServiceC");

            _assert.True(File.Exists(this.GetPath(@"Console\Console.Windows.csproj")));
            _assert.True(File.Exists(this.GetPath(@"Submodule\Library\Library.Windows.csproj")));

            libraryContents = this.ReadFile(@"Submodule\Library\Library.Windows.csproj");

            _assert.Contains("LIBRARY_SERVICE_B;", libraryContents);
        }
Esempio n. 7
0
        public void GenerationIsCorrect()
        {
            this.SetupTest("ServicesDisable");

            this.Generate();

            _assert.True(File.Exists(this.GetPath(@"Console\Console.Windows.csproj")));
            _assert.True(File.Exists(this.GetPath(@"Submodule\Library\Library.Windows.csproj")));
            _assert.True(File.Exists(this.GetPath(@"Submodule\Library\LibraryExcludable.Windows.csproj")));

            var consoleContents           = this.ReadFile(@"Console\Console.Windows.csproj");
            var libraryContents           = this.ReadFile(@"Submodule\Library\Library.Windows.csproj");
            var libraryExcludableContents = this.ReadFile(@"Submodule\Library\LibraryExcludable.Windows.csproj");

            _assert.Contains("CONSOLE_SERVICE_A;", consoleContents);
            _assert.Contains("LIBRARY_SERVICE_B;", libraryContents);
            _assert.Contains("LIBRARY_SERVICE_C;", libraryContents);
            _assert.Contains("LIBRARY_SERVICE_D;", libraryExcludableContents);

            this.Generate(args: "--disable Console/ServiceA");

            _assert.True(File.Exists(this.GetPath(@"Console\Console.Windows.csproj")));
            _assert.True(File.Exists(this.GetPath(@"Submodule\Library\Library.Windows.csproj")));
            _assert.False(File.Exists(this.GetPath(@"Submodule\Library\LibraryExcludable.Windows.csproj")));

            consoleContents = this.ReadFile(@"Console\Console.Windows.csproj");
            libraryContents = this.ReadFile(@"Submodule\Library\Library.Windows.csproj");

            _assert.DoesNotContain("CONSOLE_SERVICE_A;", consoleContents);
            _assert.DoesNotContain("LIBRARY_SERVICE_B;", libraryContents);
            _assert.Contains("LIBRARY_SERVICE_C;", libraryContents);

            this.Generate(args: "--disable Library/ServiceB");

            _assert.True(File.Exists(this.GetPath(@"Console\Console.Windows.csproj")));
            _assert.True(File.Exists(this.GetPath(@"Submodule\Library\Library.Windows.csproj")));
            _assert.False(File.Exists(this.GetPath(@"Submodule\Library\LibraryExcludable.Windows.csproj")));

            consoleContents = this.ReadFile(@"Console\Console.Windows.csproj");
            libraryContents = this.ReadFile(@"Submodule\Library\Library.Windows.csproj");

            _assert.DoesNotContain("CONSOLE_SERVICE_A;", consoleContents);
            _assert.DoesNotContain("LIBRARY_SERVICE_B;", libraryContents);
            _assert.Contains("LIBRARY_SERVICE_C;", libraryContents);

            // Protobuild now returns with exit code 1 if you try to disable
            // a service that is required.
            this.Generate(args: "--disable Library/ServiceC", expectFailure: true);
        }
        public void GenerationIsCorrect()
        {
            this.SetupTest("iOSLegacyAPIGenerationWorks");

            this.Generate("iOS");

            _assert.True(File.Exists(this.GetPath(@"App\App.iOS.csproj")));

            var appContents = this.ReadFile(@"App\App.iOS.csproj");

            _assert.DoesNotContain(@"Xamarin.iOS", appContents);
            _assert.DoesNotContain(@"$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets", appContents);
            _assert.Contains(@"monotouch", appContents);
            _assert.Contains(@"$(MSBuildToolsPath)\Microsoft.CSharp.targets", appContents);
        }
        public void GenerationIsCorrect(string parent, string child)
        {
            this.SetupTest("ExampleCSTools", parent: parent, child: child);

            // Newer versions of Protobuild upgrade this file, but for regression testing we need the old
            // format (it's expected that the old format will be used in conjunction with old versions of
            // Protobuild, which are the version that we're regression testing with).  Copy across
            // the old version before the start of every test here.
            File.Copy(this.GetPath(@"Build\ModuleOldFormat.xml"), this.GetPath(@"Build\Module.xml"), true);
            File.Copy(this.GetPath(@"CSTools\Build\ModuleOldFormat.xml"), this.GetPath(@"CSTools\Build\Module.xml"), true);

            try
            {
                this.Generate();

                _assert.True(File.Exists(this.GetPath(@"Game\Game.Windows.csproj")));
                _assert.True(File.Exists(this.GetPath(@"CSTools\Tool\Tool.Windows.csproj")));

                var gameContents     = this.ReadFile(@"Game\Game.Windows.csproj");
                var solutionContents = this.ReadFile(@"Game.Windows.sln");

                _assert.DoesNotContain("Tool.Windows.csproj", gameContents);
                _assert.Contains("Game.Windows.csproj", solutionContents);
                _assert.Contains("Tool.Windows.csproj", solutionContents);
            }
            finally
            {
                // Reset the module info back to it's original state so we don't have a dirty working copy.
                File.Copy(this.GetPath(@"Build\ModuleOldFormat.xml"), this.GetPath(@"Build\Module.xml"), true);
                File.Copy(this.GetPath(@"CSTools\Build\ModuleOldFormat.xml"), this.GetPath(@"CSTools\Build\Module.xml"), true);
            }
        }
Esempio n. 10
0
        public void PackageIsCorrect()
        {
            this.SetupTest("PackageAutomaticDoesNotCopyIncludeReference", isPackTest: true);

            this.OtherMode("pack", args: ". Windows.tar.lzma Windows", purge: false);

            var packagedFiles = this.LoadPackage("Windows.tar.lzma");

            _assert.Contains("Build/", packagedFiles.Keys);
            _assert.Contains("Build/Module.xml", packagedFiles.Keys);
            _assert.Contains("Build/Projects/", packagedFiles.Keys);
            _assert.Contains("Build/Projects/ExternalProject.definition", packagedFiles.Keys);
            _assert.Contains("Build/Projects/IncludeProject.definition", packagedFiles.Keys);
            _assert.Contains("Build/Projects/StandardProject.definition", packagedFiles.Keys);

            using (var stream = new MemoryStream(packagedFiles["Build/Projects/StandardProject.definition"]))
            {
                using (var reader = new StreamReader(stream))
                {
                    var content = reader.ReadToEnd();

                    _assert.Contains("ExternalProject", content);
                    _assert.DoesNotContain("IncludeProject", content);
                }
            }
        }
        public void SyncIsCorrect()
        {
            this.SetupTest("SyncDoesNotIncludeContentWorks");

            // Reset the definition back to it's original version for the test.
            var original = this.GetPath(@"Build\OriginalProjects\Console.definition");
            var target   = this.GetPath(@"Build\Projects\Console.definition");

            File.Copy(original, target, true);

            this.OtherMode("sync", "Windows", purge: false);

            var targetContents = this.ReadFile(@"Build\Projects\Console.definition");

            try
            {
                _assert.Contains("Program.cs", targetContents);
                _assert.Contains("Added.cs", targetContents);
                _assert.DoesNotContain("Content", targetContents);
            }
            finally
            {
                // Reset the file back after the test passes so that Git doesn't
                // report this file as changed.
                File.Copy(original, target, true);
            }
        }
Esempio n. 12
0
        public void GenerationIsCorrect()
        {
            this.SetupTest("iOSOnWindowsHasAlternatePostBuildHookSystem");

            this.Generate("iOS", hostPlatform: "Windows");

            _assert.True(File.Exists(this.GetPath(@"Console\Console.iOS.csproj")));

            var consoleContents = this.ReadFile(@"Console\Console.iOS.csproj");

            _assert.Contains("LocalTouch Path", consoleContents);

            this.Generate("tvOS", hostPlatform: "Windows");

            _assert.True(File.Exists(this.GetPath(@"Console\Console.tvOS.csproj")));

            consoleContents = this.ReadFile(@"Console\Console.tvOS.csproj");

            _assert.Contains("LocalTouch Path", consoleContents);

            this.Generate("Windows", hostPlatform: "Windows");

            _assert.True(File.Exists(this.GetPath(@"Console\Console.Windows.csproj")));

            consoleContents = this.ReadFile(@"Console\Console.Windows.csproj");

            _assert.DoesNotContain("LocalTouch Path", consoleContents);
        }
        public void GenerationIsCorrect()
        {
            this.SetupTest("CPlusPlusExternalPlatformReferenceWorks");

            this.Generate("Windows");

            _assert.True(File.Exists(this.GetPath(@"Console\Console.Windows.csproj")));
            _assert.True(
                File.Exists(this.GetPath(@"Library\Library.Windows.mdproj")) ||
                File.Exists(this.GetPath(@"Library\Library.Windows.vcxproj")));

            var consoleContents = this.ReadFile(@"Console\Console.Windows.csproj");

            if (Path.DirectorySeparatorChar == '/')
            {
                _assert.Contains("libLibrary.so", consoleContents);
            }
            else
            {
                _assert.Contains("Library32.dll", consoleContents);
                _assert.Contains("Library64.dll", consoleContents);
            }

            _assert.Contains("LibraryBinding.dll", consoleContents);

            this.Generate("Linux");

            _assert.True(File.Exists(this.GetPath(@"Console\Console.Linux.csproj")));
            _assert.True(
                File.Exists(this.GetPath(@"Library\Library.Linux.mdproj")) ||
                File.Exists(this.GetPath(@"Library\Library.Linux.vcxproj")));

            consoleContents = this.ReadFile(@"Console\Console.Linux.csproj");

            if (Path.DirectorySeparatorChar == '/')
            {
                _assert.DoesNotContain("libLibrary.so", consoleContents);
            }
            else
            {
                _assert.DoesNotContain("Library32.dll", consoleContents);
                _assert.DoesNotContain("Library64.dll", consoleContents);
            }

            _assert.DoesNotContain("LibraryBinding.dll", consoleContents);
        }
        public void GenerationIsCorrect()
        {
            this.SetupTest("ProjectSpecificOutputFolder");

            this.Generate("Windows");

            _assert.True(File.Exists(this.GetPath(@"ConsoleA\ConsoleA.Windows.csproj")));
            _assert.True(File.Exists(this.GetPath(@"ConsoleB\ConsoleB.Windows.csproj")));

            var consoleAContents = this.ReadFile(@"ConsoleA\ConsoleA.Windows.csproj");
            var consoleBContents = this.ReadFile(@"ConsoleB\ConsoleB.Windows.csproj");

            _assert.Contains("<OutputPath>bin\\Windows\\AnyCPU\\Debug</OutputPath>", consoleAContents);
            _assert.DoesNotContain("<OutputPath>bin\\ConsoleA\\Windows\\AnyCPU\\Debug</OutputPath>", consoleAContents);
            _assert.Contains("<OutputPath>bin\\ConsoleB\\Windows\\AnyCPU\\Debug</OutputPath>", consoleBContents);
            _assert.DoesNotContain("<OutputPath>bin\\Windows\\AnyCPU\\Debug</OutputPath>", consoleBContents);
        }
        public void GenerationIsCorrect()
        {
            this.SetupTest("ExternalProjectReferencesAreFlattened");

            this.Generate("Windows");

            _assert.True(File.Exists(this.GetPath(@"Console\Console.Windows.csproj")));

            var consoleContents = this.ReadFile(@"Console\Console.Windows.csproj");

            _assert.DoesNotContain("ExternalA", consoleContents);
            _assert.DoesNotContain("ExternalB", consoleContents);
            _assert.DoesNotContain("ExternalC", consoleContents);
            _assert.DoesNotContain("ExternalD", consoleContents);
            _assert.DoesNotContain("ExternalE", consoleContents);
            _assert.Contains("ExpectedTargetMet", consoleContents);
            _assert.Contains("ExpectedPlatformTargetMet", consoleContents);
        }
        public void GenerationIsCorrect()
        {
            this.SetupTest("NuGetPackagesDetectedFromParent");

            this.Generate("Windows");

            _assert.True(File.Exists(this.GetPath(@"Module.Windows.sln")));
            _assert.True(File.Exists(this.GetPath(@"Submodule\Module.Windows.sln")));
            _assert.True(File.Exists(this.GetPath(@"Submodule\Console\Console.Windows.csproj")));

            var consoleContents = this.ReadFile(@"Submodule\Console\Console.Windows.csproj");

            _assert.Contains("portable-net4+sl5+wp8+win8+wpa81+MonoTouch+MonoAndroid", consoleContents);
            _assert.Contains("Test.dll", consoleContents);
            _assert.Contains("<HintPath>..\\..\\packages", consoleContents);
            _assert.DoesNotContain("<HintPath>packages", consoleContents);
            _assert.DoesNotContain("<HintPath>..\\packages", consoleContents);
        }
Esempio n. 17
0
        public void GenerationIsCorrect()
        {
            this.SetupTest("ServicesLibraryNotBuiltWhenNotUsed");

            this.Generate();

            _assert.True(File.Exists(this.GetPath(@"Console\Console.Windows.csproj")));
            _assert.True(File.Exists(this.GetPath(@"Module.Windows.sln")));
            _assert.False(File.Exists(this.GetPath(@"Submodule\Library\Library.Windows.csproj")));
            _assert.True(File.Exists(this.GetPath(@"Submodule\Submodule.Windows.sln")));

            var moduleContents    = this.ReadFile(@"Module.Windows.sln");
            var submoduleContents = this.ReadFile(@"Submodule\Submodule.Windows.sln");

            _assert.Contains("Console.Windows.csproj", moduleContents);
            _assert.DoesNotContain("Library.Windows.csproj", moduleContents);
            _assert.DoesNotContain("Library.Windows.csproj", submoduleContents);
        }
        public void GenerationIsCorrect()
        {
            this.SetupTest("ConfigurationMappingWorks");

            this.Generate("Windows");

            _assert.True(File.Exists(this.GetPath(@"Module.Windows.sln")));

            var solutionContents = this.ReadFile(@"Module.Windows.sln");

            _assert.DoesNotContain("{73E1432F-7BB5-4E5A-B952-F9CBCEA7FG76}.Debug|Any CPU.ActiveCfg = Debug|Any CPU", solutionContents);
            _assert.DoesNotContain("{73E1432F-7BB5-4E5A-B952-F9CBCEA7FG76}.Debug|Any CPU.Build.0 = Debug|Any CPU", solutionContents);
            _assert.DoesNotContain("{73E1432F-7BB5-4E5A-B952-F9CBCEA7FG76}.Release|Any CPU.ActiveCfg = Release|Any CPU", solutionContents);
            _assert.DoesNotContain("{73E1432F-7BB5-4E5A-B952-F9CBCEA7FG76}.Release|Any CPU.Build.0 = Release|Any CPU", solutionContents);
            _assert.Contains("{73E1432F-7BB5-4E5A-B952-F9CBCEA7FG76}.Debug|Any CPU.ActiveCfg = Debug|SomeConf", solutionContents);
            _assert.Contains("{73E1432F-7BB5-4E5A-B952-F9CBCEA7FG76}.Debug|Any CPU.Build.0 = Debug|SomeConf", solutionContents);
            _assert.Contains("{73E1432F-7BB5-4E5A-B952-F9CBCEA7FG76}.Release|Any CPU.ActiveCfg = Release|SomeConf", solutionContents);
            _assert.Contains("{73E1432F-7BB5-4E5A-B952-F9CBCEA7FG76}.Release|Any CPU.Build.0 = Release|SomeConf", solutionContents);
        }
Esempio n. 19
0
        public void MultiPassResolutionDoesNotIntroduceConflictingRequirements()
        {
            var a = new Service
            {
                ProjectName  = "Test",
                ServiceName  = "A",
                DesiredLevel = ServiceDesiredLevel.Recommended,
                Requires     = new List <string> {
                    "Test/B"
                },
            };
            var b = new Service
            {
                ProjectName = "Test",
                ServiceName = "B",
            };
            var c = new Service
            {
                ProjectName = "Test",
                ServiceName = "C",
                Conflicts   = new List <string> {
                    "Test/A", "Test/B"
                },
            };

            var services = new List <Service> {
                a, b, c
            };

            var manager = new ServiceManager("Windows");

            manager.EnableService("Test/C");

            manager.EnableDefaultAndExplicitServices(services);

            // This should not throw an exception.
            var enabled = manager.ResolveServices(services);

            _assert.DoesNotContain(a, enabled);
            _assert.DoesNotContain(b, enabled);
            _assert.Contains(c, enabled);
        }
        public void GenerationIsCorrect()
        {
            this.SetupTest("PostBuildHookWorks");

            this.Generate("Windows");

            _assert.True(File.Exists(this.GetPath(@"Console\Console.Windows.csproj")));
            _assert.True(File.Exists(this.GetPath(@"Hook\Hook.Windows.csproj")));
            _assert.True(File.Exists(this.GetPath(@"Hook.Library\Hook.Library.Windows.csproj")));

            var consoleContents     = this.ReadFile(@"Console\Console.Windows.csproj");
            var hookContents        = this.ReadFile(@"Hook\Hook.Windows.csproj");
            var hookLibraryContents = this.ReadFile(@"Hook.Library\Hook.Library.Windows.csproj");

            _assert.Contains(@"Running &quot;Hook&quot; post-build hook...", consoleContents);
            _assert.Contains(@"Running &quot;Hook.External&quot; post-build hook...", consoleContents);
            _assert.DoesNotContain(@"Running &quot;Hook&quot; post-build hook...", hookContents);
            _assert.Contains(@"Running &quot;Hook.External&quot; post-build hook...", hookContents);
            _assert.DoesNotContain(@"Running &quot;Hook&quot; post-build hook...", hookLibraryContents);
            _assert.Contains(@"Running &quot;Hook.External&quot; post-build hook...", hookLibraryContents);
        }
        public void GenerationIsCorrect()
        {
            this.SetupTest("HostPlatformGenerationNeverOccursIfFeatureDisabled");

            var @out = this.Generate("Android", hostPlatform: "Windows", capture: true);

            var solutionPath = this.GetPath("Module.Android.sln");

            _assert.True(File.Exists(solutionPath));

            var solutionContents = this.ReadFile(solutionPath);

            _assert.Contains("Console.Android.csproj", solutionContents);
            _assert.DoesNotContain("Console.Windows.csproj", solutionContents);
            _assert.DoesNotContain("Console.Linux.csproj", solutionContents);
            _assert.DoesNotContain("Console.MacOS.csproj", solutionContents);

            _assert.Contains("Starting generation of projects for Android", @out.Item1);
            _assert.DoesNotContain("Starting generation of projects for Windows", @out.Item1);
            _assert.Contains("WARNING: One or more projects requires host platforms to be generated", @out.Item2);
        }
        public void GenerationIsCorrect()
        {
            this.SetupTest("HostPlatformGenerationWorks");

            var @out = this.Generate("Android", hostPlatform: "Windows", capture: true);

            var solutionPath = this.GetPath("Module.Android.sln");

            _assert.True(File.Exists(solutionPath));

            var solutionContents = this.ReadFile(solutionPath);

            _assert.Contains("Console.Android.csproj", solutionContents);
            _assert.Contains("Console.Windows.csproj", solutionContents);
            _assert.DoesNotContain("Console.Linux.csproj", solutionContents);
            _assert.DoesNotContain("Console.MacOS.csproj", solutionContents);

            _assert.Contains("Starting generation of projects for Android", @out.Item1);
            _assert.Contains("Starting generation of projects for Windows", @out.Item1);
            _assert.Contains("One or more projects required the presence of host platform", @out.Item1);
        }
        public void GenerationIsCorrect()
        {
            this.SetupTest("ServicesNotDefaultForRoot");

            this.Generate();

            _assert.True(File.Exists(this.GetPath(@"Console\Console.Windows.csproj")));

            var projectContents = this.ReadFile(@"Console\Console.Windows.csproj");

            _assert.DoesNotContain("CONSOLE_SERVICE;", projectContents);
        }
Esempio n. 24
0
        public void GenerationIsCorrect()
        {
            this.SetupTest("DuplicateExternalProjects");

            this.Generate("Windows");

            _assert.True(File.Exists(this.GetPath(@"DuplicateExternalProjects.Windows.sln")));

            var solutionContents = this.ReadFile(@"DuplicateExternalProjects.Windows.sln");

            _assert.Contains("ThirdParty1.csproj", solutionContents);
            _assert.DoesNotContain("ThirdParty2.csproj", solutionContents);
        }
        public void GenerationIsCorrect()
        {
            this.SetupTest("PlatformSpecificOutputFalse");

            this.Generate("Windows");

            _assert.True(File.Exists(this.GetPath(@"Test\Test.Windows.csproj")));

            var projectContents = this.ReadFile(@"Test\Test.Windows.csproj");

            _assert.DoesNotContain(@"bin\Windows\AnyCPU\Release", projectContents);
            _assert.Contains(@"bin\Release", projectContents);
        }
Esempio n. 26
0
        public void GenerationIsCorrect()
        {
            this.SetupTest("IncludeProjectViaSubmoduleWorks");

            this.Generate("Windows");

            _assert.True(File.Exists(this.GetPath(@"Module.Windows.sln")));
            _assert.True(File.Exists(this.GetPath(@"Console\Console.Windows.csproj")));
            _assert.False(File.Exists(this.GetPath(@"Submodule\IncludableA\IncludableA.Windows.csproj")));
            _assert.False(File.Exists(this.GetPath(@"Submodule\IncludableB\IncludableB.Windows.csproj")));

            var projectContents = this.ReadFile(@"Console\Console.Windows.csproj");

            _assert.Contains("<Link>Included Code\\Submodule/IncludableA\\MyIncludableClass.cs</Link>", projectContents);
            _assert.Contains("<Link>Included Code\\Submodule/IncludableB\\MyIncludableClass.cs</Link>", projectContents);
            _assert.Contains("<FromIncludeProject>", projectContents);
            _assert.Contains("..\\Submodule\\IncludableA\\MyIncludableClass.cs", projectContents);
            _assert.Contains("..\\Submodule\\IncludableB\\MyIncludableClass.cs", projectContents);
            _assert.DoesNotContain("<Reference Include=\"IncludableA\" />", projectContents);
            _assert.DoesNotContain("<Reference Include=\"IncludableB\" />", projectContents);
            _assert.DoesNotContain("<Reference Include=\"External\" />", projectContents);
        }
Esempio n. 27
0
        public void GenerationIsCorrect()
        {
            this.SetupTest("ExcludeAttributeMissingOnItemsThatDontUseIt");

            this.Generate("Windows");

            _assert.True(File.Exists(this.GetPath(@"Module.Windows.sln")));
            _assert.True(File.Exists(this.GetPath(@"Console\Console.Windows.csproj")));

            var projectContents = this.ReadFile(@"Console\Console.Windows.csproj");

            _assert.DoesNotContain("Exclude=", projectContents);
        }
Esempio n. 28
0
        public void GenerationIsCorrect()
        {
            this.SetupTest("PackageResolutionDoesNotOccurWhenPackageManagementDisabled");

            // Make sure the Package directory is removed so we have a clean test every time.
            if (Directory.Exists(this.GetPath("Package")))
            {
                PathUtils.AggressiveDirectoryDelete(this.GetPath("Package"));
            }

            var output = this.Generate(capture: true);

            _assert.DoesNotContain("Starting resolution of packages for", output.Item1);
        }
        public void GenerationIsCorrect()
        {
            this.SetupTest("MacOSPlatformForceAPIXamarinMacWorks");

            var @out = this.Generate("MacOS", capture: true);

            var appPath = this.GetPath("App\\App.MacOS.csproj");

            _assert.True(File.Exists(appPath));

            var appContents = this.ReadFile(appPath);

            _assert.Contains("<Reference Include=\"Xamarin.Mac\"", appContents);
            _assert.Contains("{A3F8F2AB-B479-4A4A-A458-A89E7DC349F1}", appContents);
            _assert.Contains("Xamarin.Mac.CSharp.targets", appContents);
            _assert.DoesNotContain("PLATFORM_MACOS_LEGACY", appContents);
        }
        public void GenerationIsCorrect()
        {
            this.SetupTest("MacOSPlatformForceAPIXamMacWorks");

            var @out = this.Generate("MacOS", capture: true);

            var appPath = this.GetPath("App\\App.MacOS.csproj");

            _assert.True(File.Exists(appPath));

            var appContents = this.ReadFile(appPath);

            _assert.Contains("<Reference Include=\"XamMac\"", appContents);
            _assert.Contains("{42C0BBD9-55CE-4FC1-8D90-A7348ABAFB23}", appContents);
            _assert.DoesNotContain("Xamarin.Mac.CSharp.targets", appContents);
            _assert.Contains("PLATFORM_MACOS_LEGACY", appContents);
        }