예제 #1
0
        public void MM0176(bool xm45, string tfv)
        {
            RunMMPTest(tmpDir => {
                var test = new TI.UnifiedTestConfig(tmpDir)
                {
                    References = "<PackageReference Include=\"xunit.runner.utility\" Version=\"2.4.0\" />",
                    TestCode   = "System.Console.WriteLine (typeof (Xunit.AfterTestFinished));",
                    XM45       = xm45,
                };
                if (tfv != null)
                {
                    test.TargetFrameworkVersion = $"<TargetFrameworkVersion>{tfv}</TargetFrameworkVersion>";
                }

                string project = TI.GenerateUnifiedExecutableProject(test);
                TI.NugetRestore(project);
                var rv = new OutputText(TI.BuildProject(project), string.Empty);
                Console.WriteLine(rv.BuildResult);
                if (xm45)
                {
                    var referenced_version = tfv == null ? "2.0.0.0" : "4.0.0.0";
                    rv.Messages.AssertWarningPattern(176, $"The assembly 'System.Web, Version={referenced_version}, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' was resolved from the system's GAC: /Library/Frameworks/Mono.framework/Versions/.*/lib/mono/gac/System.Web/4.0.0.0__b03f5f7f11d50a3a/System.Web.dll. This could potentially be a problem in the future; to avoid such problems, please make sure to not use assemblies only available in the system's GAC.");
                    rv.Messages.AssertWarningPattern(176, $"The assembly 'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' was resolved from the system's GAC: /Library/Frameworks/Mono.framework/Versions/.*/lib/mono/gac/System.Drawing/4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll. This could potentially be a problem in the future; to avoid such problems, please make sure to not use assemblies only available in the system's GAC.");
                    rv.Messages.AssertWarningPattern(176, $"The assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' was resolved from the system's GAC: /Library/Frameworks/Mono.framework/Versions/.*/lib/mono/gac/System.Web.ApplicationServices/4.0.0.0__31bf3856ad364e35/System.Web.ApplicationServices.dll. This could potentially be a problem in the future; to avoid such problems, please make sure to not use assemblies only available in the system's GAC.");
                    // Don't assert number of warnings, because we get a few "MM2006: Native library 'foo.dll' was referenced but could not be found." warnings as well.
                }
                else
                {
                    rv.Messages.AssertWarningCount(0);
                }
            });
        }
        // [Test] https://github.com/xamarin/xamarin-macios/issues/4110
        public void ExtensionProjectPackageReferencs_Build()
        {
            MMPTests.RunMMPTest(tmpDir => {
                TI.CopyDirectory(Path.Combine(TI.FindSourceDirectory(), @"Today"), tmpDir);

                string project = Path.Combine(tmpDir, "Today/TodayExtensionTest.csproj");
                string main    = Path.Combine(tmpDir, "Today/TodayViewController.cs");

                TI.CopyFileWithSubstitutions(project, project, s => s.Replace("%ITEMGROUP%", PackageReference));
                TI.CopyFileWithSubstitutions(main, main, s => s.Replace("%TESTCODE%", TestCode));

                TI.NugetRestore(project);
                string output = TI.BuildProject(Path.Combine(tmpDir, "Today/TodayExtensionTest.csproj"), isUnified: true);
                Assert.IsTrue(!output.Contains("MM2013"));
            });
        }
예제 #3
0
        public void ExtensionProjectPackageReferencs_Build()
        {
            MMPTests.RunMMPTest(tmpDir => {
                TI.CopyDirectory(Path.Combine(TI.FindSourceDirectory(), @"Today"), tmpDir);

                string project = Path.Combine(tmpDir, "Today/TodayExtensionTest.csproj");
                string main    = Path.Combine(tmpDir, "Today/TodayViewController.cs");

                TI.CopyFileWithSubstitutions(project, project, s => s.Replace("%ITEMGROUP%", PackageReference));
                TI.CopyFileWithSubstitutions(main, main, s => s.Replace("%TESTCODE%", TestCode));

                TI.NugetRestore(project);
                var buildResult = TI.BuildProject(Path.Combine(tmpDir, "Today/TodayExtensionTest.csproj"));
                buildResult.Messages.AssertNoMessage(2013);
            });
        }
        // [TestCase (true)] https://github.com/xamarin/xamarin-macios/issues/4110
        // [TestCase (false)] https://github.com/xamarin/xamarin-macios/issues/4110
        public void AppsWithPackageReferencs_BuildAndRun(bool full)
        {
            MMPTests.RunMMPTest(tmpDir => {
                var config = new TI.UnifiedTestConfig(tmpDir)
                {
                    ItemGroup = PackageReference,
                    TestCode  = TestCode + @"			if (output == ""[1,2,3]"")
				"                ,
                    XM45      = full
                };
                TI.AddGUIDTestCode(config);

                string project = TI.GenerateUnifiedExecutableProject(config);
                TI.NugetRestore(project);
                TI.BuildProject(project, true);
                TI.RunGeneratedUnifiedExecutable(config);
            });
        }
예제 #5
0
        // context https://github.com/xamarin/xamarin-macios/issues/7113
        public void SatellitesFromNuget(bool full)
        {
            MMPTests.RunMMPTest(tmpDir => {
                var config = new TI.UnifiedTestConfig(tmpDir)
                {
                    ItemGroup = @"<ItemGroup><PackageReference Include = ""Humanizer"" Version = ""2.7.2"" /></ItemGroup>",
                    TestCode  = "Humanizer.DateHumanizeExtensions.Humanize (System.DateTime.UtcNow.AddHours (-30));\n",
                    XM45      = full
                };
                TI.AddGUIDTestCode(config);

                string project = TI.GenerateUnifiedExecutableProject(config);
                TI.NugetRestore(project);
                TI.BuildProject(project);

                var appDir = Path.Combine(tmpDir, "bin", "Debug", full ? "XM45Example.app" : "UnifiedExample.app");
                Assert.True(File.Exists(Path.Combine(appDir, "Contents", "MonoBundle", "fr", "Humanizer.resources.dll")), "fr");
            });
        }