コード例 #1
0
            public TestContext(params NetPortableProfile[] portableProfiles)
            {
                Collection = new NetPortableProfileCollection();
                Collection.AddRange(portableProfiles);

                Table = new NetPortableProfileTable(Collection);

                CompatibilityProvider = new ReferenceAssemblyCompatibilityProvider(Collection);

                NameProvider = new ReferenceAssemblyFrameworkNameProvider(Collection);
            }
コード例 #2
0
        public void LoadSupportedFrameworkCorrectsTheWP7Framework()
        {
            // Arrange
            string content = @"
<Framework
    Identifier=""Silverlight""
    Profile=""WindowsPhone*""
    MinimumVersion=""4.0""
    DisplayName=""Windows Phone""
    MinimumVersionDisplayName=""7"" />";

            // Act
            FrameworkName fx = NetPortableProfileTable.LoadSupportedFramework(content.AsStream());

            // Assert
            Assert.Equal(new FrameworkName("Silverlight, Version=3.0, Profile=WindowsPhone"), fx);
        }
コード例 #3
0
ファイル: Class1.cs プロジェクト: uniblockchain/NStratis.API
        private string FindMagicFreakingNugetString(string profile)
        {
            if (profile == "Profile259")
            {
                return("net45+win+wpa81+wp80+Xamarin.iOS10+MonoAndroid10+MonoTouch10");
            }
            if (profile == "Profile111")
            {
                return("net45+win+wpa81+Xamarin.iOS10+MonoAndroid10+MonoTouch10");
            }
            var prof = NetPortableProfileTable.GetProfile(profile);

            if (prof == null)
            {
                throw new NotSupportedException("Profile not supported " + profile);
            }
            return(prof.CustomProfileString);
        }
コード例 #4
0
        public void TestParseWithCustomProfileString5WithOptionalFrameworkAndTreatedAsOptional()
        {
            // Arrange
            var collection = new NetPortableProfileCollection();
            var profile1   = new NetPortableProfile(
                "Profile1",
                new[] {
                new FrameworkName(".NETFramework, Version=4.5"),
                new FrameworkName("Silverlight, Version=4.0"),
                new FrameworkName("WindowsPhone, Version=7.1"),
            },
                new[] {
                new FrameworkName("MonoTouch, Version=0.0"),
                new FrameworkName("MonoAndroid, Version=2.0"),
            });

            var profile2 = new NetPortableProfile(
                "Profile2",
                new[] {
                new FrameworkName(".NetCore, Version=4.5"),
                new FrameworkName("Silverlight, Version=3.0"),
                new FrameworkName("WindowsPhone, Version=7.1"),
            });

            collection.Add(profile1);
            collection.Add(profile2);

            var table = new NetPortableProfileTable(collection);

            // Act
            // Default value of second parameter treatOptionalFrameworksAsSupportedFrameworks is false
            var profile = NetPortableProfile.Parse(
                table,
                "net45+sl40+wp71+MonoTouch+MonoAndroid20");

            // Assert
            Assert.Equal(3, profile.SupportedFrameworks.Count);
            Assert.Equal(2, profile.OptionalFrameworks.Count);
            Assert.True(profile.SupportedFrameworks.Contains(new FrameworkName(".NETFramework, Version=4.5")));
            Assert.True(profile.SupportedFrameworks.Contains(new FrameworkName("Silverlight, Version=4.0")));
            Assert.True(profile.SupportedFrameworks.Contains(new FrameworkName("WindowsPhone, Version=7.1")));
            Assert.True(profile.OptionalFrameworks.Contains(new FrameworkName("MonoTouch, Version=0.0")));
            Assert.True(profile.OptionalFrameworks.Contains(new FrameworkName("MonoAndroid, Version=2.0")));
        }
コード例 #5
0
        public void TestParseWithCustomProfileString4WithDifferentOrderingOfFrameworks()
        {
            // Arrange
            var collection = new NetPortableProfileCollection();
            var profile1   = new NetPortableProfile(
                "Profile1",
                new[] {
                new FrameworkName(".NETFramework, Version=4.5"),
                new FrameworkName("Silverlight, Version=4.0"),
                new FrameworkName("WindowsPhone, Version=7.1"),
            },
                new[] {
                new FrameworkName("MonoTouch, Version=0.0"),
                new FrameworkName("MonoAndroid, Version=2.0"),
            });

            var profile2 = new NetPortableProfile(
                "Profile2",
                new[] {
                new FrameworkName(".NetCore, Version=4.5"),
                new FrameworkName("Silverlight, Version=3.0"),
                new FrameworkName("WindowsPhone, Version=7.1"),
            });

            collection.Add(profile1);
            collection.Add(profile2);

            var table = new NetPortableProfileTable(collection);

            // Act
            var profile = NetPortableProfile.Parse(
                table,
                "net45+sl40+MonoTouch+wp71+MonoAndroid20");

            // Assert
            Assert.Equal(5, profile.SupportedFrameworks.Count);
            Assert.Equal(0, profile.OptionalFrameworks.Count);
            Assert.True(profile.SupportedFrameworks.Contains(new FrameworkName(".NETFramework, Version=4.5")));
            Assert.True(profile.SupportedFrameworks.Contains(new FrameworkName("Silverlight, Version=4.0")));
            Assert.True(profile.SupportedFrameworks.Contains(new FrameworkName("WindowsPhone, Version=7.1")));
            Assert.True(profile.SupportedFrameworks.Contains(new FrameworkName("MonoTouch, Version=0.0")));
        }
コード例 #6
0
        public void TestParseWithCustomProfileString6WithOptionalFrameworkAndTreatedAsSupported()
        {
            // Arrange & Act
            var profileCollection = new NetPortableProfileCollection();
            var profile1          = new NetPortableProfile(
                "Profile1",
                new[] {
                new FrameworkName(".NETFramework, Version=4.5"),
                new FrameworkName("Silverlight, Version=4.0"),
                new FrameworkName("WindowsPhone, Version=7.1"),
            },
                new[] {
                new FrameworkName("MonoTouch, Version=0.0"),
                new FrameworkName("MonoAndroid, Version=2.0"),
            });

            var profile2 = new NetPortableProfile(
                "Profile2",
                new[] {
                new FrameworkName(".NetCore, Version=4.5"),
                new FrameworkName("Silverlight, Version=3.0"),
                new FrameworkName("WindowsPhone, Version=7.1"),
            });

            profileCollection.Add(profile1);
            profileCollection.Add(profile2);

            var portableProfileTable = new NetPortableProfileTable(profileCollection);

            var profile = NetPortableProfile.Parse("net45+sl40+wp71+MonoTouch+MonoAndroid20", treatOptionalFrameworksAsSupportedFrameworks: true);

            // Assert
            Assert.Equal(5, profile.SupportedFrameworks.Count);
            Assert.Equal(0, profile.OptionalFrameworks.Count);
            Assert.True(profile.SupportedFrameworks.Contains(new FrameworkName(".NETFramework, Version=4.5")));
            Assert.True(profile.SupportedFrameworks.Contains(new FrameworkName("Silverlight, Version=4.0")));
            Assert.True(profile.SupportedFrameworks.Contains(new FrameworkName("WindowsPhone, Version=7.1")));
            Assert.True(profile.SupportedFrameworks.Contains(new FrameworkName("MonoTouch, Version=0.0")));
        }
コード例 #7
0
        public void TestIsCompatibleWithPortableProfile11WithMonoProjectWithVersionLesserThanInstalledProfile()
        {
            // Arrange
            var profile1 = new NetPortableProfile(
                "Profile1",
                new[] {
                new FrameworkName(".NETFramework, Version=4.5"),
                new FrameworkName("Silverlight, Version=4.0"),
                new FrameworkName("WindowsPhone, Version=7.1"),
                new FrameworkName("Windows, Version=8.0"),
            },
                new[] {
                new FrameworkName("MonoTouch, Version=1.0"),
                new FrameworkName("MonoAndroid, Version=2.0"),
                new FrameworkName("MonoMac, Version=1.0"),
            });

            NetPortableProfileCollection profileCollection = new NetPortableProfileCollection();

            profileCollection.Add(profile1);

            var packageProfile = new NetPortableProfile(
                "ProfileXXX",
                new[] {
                new FrameworkName(".NETFramework, Version=4.0"),
                new FrameworkName("Silverlight, Version=4.0"),
                new FrameworkName("WindowsPhone, Version=7.0"),
                new FrameworkName("Windows, Version=8.0"),
            });

            var projectProfile = new FrameworkName("MonoAndroid, Version=1.0");

            var portableProfileTable = new NetPortableProfileTable(profileCollection);

            // Act & Assert
            Assert.False(packageProfile.IsCompatibleWith(projectProfile, portableProfileTable));
        }
コード例 #8
0
ファイル: VersionUtilityTest.cs プロジェクト: rikoe/nuget
        public void TestGetCompatibilityBetweenPortableLibraryAndNonPortableLibraryForMono(string projectFrameworkName, string packageTargetFrameworkName, long expectedScore)        
        {
            // Arrange
            var profile1 = new NetPortableProfile(
               "Profile1",
               new[] { 
                           new FrameworkName(".NETFramework, Version=4.5"), 
                           new FrameworkName("Silverlight, Version=4.0"),
                           new FrameworkName("WindowsPhone, Version=7.1"),
                           new FrameworkName("Windows, Version=8.0"),
                      },
               new[] { 
                           new FrameworkName("MonoTouch, Version=1.0"), 
                           new FrameworkName("MonoAndroid, Version=1.0"),
                           new FrameworkName("MonoMac, Version=1.0"),
                      });

            var profile2 = new NetPortableProfile(
               "Profile2",
               new[] { 
                           new FrameworkName(".NETFramework, Version=4.5"), 
                           new FrameworkName("WindowsPhone, Version=8.0"),
                           new FrameworkName("Windows, Version=8.0"),
                      },
               new[] { 
                           new FrameworkName("MonoTouch, Version=1.0"), 
                           new FrameworkName("MonoAndroid, Version=1.0"),
                      });

            NetPortableProfileCollection profileCollection = new NetPortableProfileCollection();
            profileCollection.Add(profile1);
            profileCollection.Add(profile2);

            var portableProfileTable = new NetPortableProfileTable(profileCollection);

            // Arrange
            var framework = VersionUtility.ParseFrameworkName(projectFrameworkName);
            var targetFramework = VersionUtility.ParseFrameworkName(packageTargetFrameworkName);

            // Act
            long score = VersionUtility.GetCompatibilityBetweenPortableLibraryAndNonPortableLibrary(framework, targetFramework, portableProfileTable);

            // Assert
            Assert.Equal(expectedScore, score);
        }
コード例 #9
0
ファイル: VersionUtilityTest.cs プロジェクト: rikoe/nuget
        public void TestGetCompatibilityBetweenPortableLibraryAndPortableLibraryWithPreLoadedPackageProfile(string frameworkName, string targetFrameworkName, int expectedScore)
        {
            var profile1 = new NetPortableProfile(
               "Profile1",
               new[] { 
                           new FrameworkName(".NETFramework, Version=4.0"), 
                           new FrameworkName("Silverlight, Version=4.0"), 
                      },
               new[] { 
                           new FrameworkName("MonoTouch, Version=0.0"), 
                           new FrameworkName("MonoAndroid, Version=0.0"), 
                      });

            NetPortableProfileCollection profileCollection = new NetPortableProfileCollection();
            profileCollection.Add(profile1);

            var portableProfileTable = new NetPortableProfileTable(profileCollection);

            // Arrange
            var framework = VersionUtility.ParseFrameworkName(frameworkName);
            var targetFramework = VersionUtility.ParseFrameworkName(targetFrameworkName);

            // Act
            int score = VersionUtility.GetCompatibilityBetweenPortableLibraryAndPortableLibrary(framework, targetFramework, portableProfileTable);

            // Assert
            Assert.Equal(expectedScore, score);
        }
コード例 #10
0
ファイル: VersionUtilityTest.cs プロジェクト: rikoe/nuget
        public void TestGetShortNameForPortableXamarinFrameworks(string frameworkIdentifier, string expectedShortName)
        {
            // Arrange
            var profileCollection = new NetPortableProfileCollection();
            var profile1 = new NetPortableProfile(
               "Profile1",
               new[] { 
                           new FrameworkName(".NETFramework, Version=4.5"), 
                           new FrameworkName("Xamarin.Mac, Version=1.0"), 
                           new FrameworkName("Xamarin.iOS, Version=1.0"), 
                      });

            var profile2 = new NetPortableProfile(
               "Profile2",
               new[] { 
                           new FrameworkName(".NETFramework, Version=4.0"), 
                           new FrameworkName(".NetCore, Version=4.5"), 
                           new FrameworkName("Xamarin.PlayStation3, Version=1.0"), 
                           new FrameworkName("Xamarin.PlayStation4, Version=1.0"), 
                           new FrameworkName("Xamarin.PlayStationVita, Version=1.0"), 
                      });

            var profile3 = new NetPortableProfile(
               "Profile3",
               new[] { 
                           new FrameworkName(".NETFramework, Version=4.0"), 
                           new FrameworkName("Xamarin.Xbox360, Version=1.0"), 
                           new FrameworkName("Xamarin.XboxOne, Version=1.0"), 
                      });

            profileCollection.Add(profile1);
            profileCollection.Add(profile2);
            profileCollection.Add(profile3);

            var portableProfileTable = new NetPortableProfileTable(profileCollection);

            var framework = new FrameworkName(frameworkIdentifier);

            // Act
            string shortName = VersionUtility.GetShortFrameworkName(framework, portableProfileTable);

            // Assert
            Assert.Equal(expectedShortName, shortName);
        }
コード例 #11
0
ファイル: Class1.cs プロジェクト: uniblockchain/NStratis.API
        public override bool Execute()
        {
            var manifest     = Manifest.ReadFrom(new MemoryStream(File.ReadAllBytes(OriginalNuspec)), true);
            var assemblyFile = File.ReadAllText(AssemblyFile);

            manifest.Metadata.Version = Find(assemblyFile, "AssemblyInformationalVersion");
            NetPortableProfileTable.GetProfile("lol"); //prevent bug of concurrency on the table
            var tasks = Projects
                        .Select(i => System.Threading.Tasks.Task.Run(() =>
            {
                ProjectCollection collection = new ProjectCollection(new Dictionary <string, string>()
                {
                    { "Configuration", Configuration }
                });
                var project            = collection.LoadProject(i.ItemSpec);
                bool portable          = false;
                var prop               = project.AllEvaluatedProperties.OfType <ProjectProperty>().FirstOrDefault(b => b.Name == "TargetFrameworkProfile");
                string targetFramework = "net45";
                if (prop != null)
                {
                    targetFramework = FindMagicFreakingNugetString(prop.EvaluatedValue);
                    portable        = true;
                }
                Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
                var instance = project.CreateProjectInstance();
                var result   = new BuildManager().Build(new BuildParameters(), new BuildRequestData(instance, new string[] { "GetTargetPath" }));
                var dll      = result.ResultsByTarget.First(_ => _.Key == "GetTargetPath").Value.Items.First().ItemSpec;
                return(new
                {
                    Generated = dll,
                    PackageConfig = new PackageReferenceFile(Path.Combine(Path.GetDirectoryName(project.FullPath), "packages.config")),
                    TargetFramework = portable ? "portable-" + targetFramework : targetFramework,
                });
            })).ToArray();

            try
            {
                var projects = tasks.Select(t => t.Result).ToArray();
                foreach (var project in projects)
                {
                    var dependencies = new ManifestDependencySet();
                    manifest.Metadata.DependencySets.Add(dependencies);
                    dependencies.TargetFramework = project.TargetFramework;
                    dependencies.Dependencies    = new List <ManifestDependency>();
                    foreach (var dep in project.PackageConfig.GetPackageReferences())
                    {
                        dependencies.Dependencies.Add(new ManifestDependency()
                        {
                            Id      = dep.Id,
                            Version = dep.Version.ToString()
                        });
                    }
                    manifest.Files.Add(new ManifestFile()
                    {
                        Target = "lib\\" + project.TargetFramework,
                        Source = project.Generated
                    });
                }
                MemoryStream ms = new MemoryStream();
                manifest.Save(ms, true);
                ms.Position = 0;
                var result = new StreamReader(ms).ReadToEnd();
                File.WriteAllText(ModifiedNuspec, result);
            }
            catch (AggregateException aex)
            {
                ExceptionDispatchInfo.Capture(aex.InnerException).Throw();
            }
            return(true);
        }
コード例 #12
0
ファイル: NetPortableProfileTest.cs プロジェクト: rikoe/nuget
        public void TestParseWithCustomProfileString6WithOptionalFrameworkAndTreatedAsSupported()
        {
            // Arrange & Act
            var profileCollection = new NetPortableProfileCollection();
            var profile1 = new NetPortableProfile(
               "Profile1",
               new[] { 
                           new FrameworkName(".NETFramework, Version=4.5"), 
                           new FrameworkName("Silverlight, Version=4.0"), 
                           new FrameworkName("WindowsPhone, Version=7.1"), 
                      },
               new[] { 
                           new FrameworkName("MonoTouch, Version=0.0"), 
                           new FrameworkName("MonoAndroid, Version=2.0"), 
                      });

            var profile2 = new NetPortableProfile(
               "Profile2",
               new[] { 
                           new FrameworkName(".NetCore, Version=4.5"), 
                           new FrameworkName("Silverlight, Version=3.0"), 
                           new FrameworkName("WindowsPhone, Version=7.1"), 
                      });
            profileCollection.Add(profile1);
            profileCollection.Add(profile2);

            var portableProfileTable = new NetPortableProfileTable(profileCollection);

            var profile = NetPortableProfile.Parse("net45+sl40+wp71+MonoTouch+MonoAndroid20", treatOptionalFrameworksAsSupportedFrameworks: true);

            // Assert
            Assert.Equal(5, profile.SupportedFrameworks.Count);
            Assert.Equal(0, profile.OptionalFrameworks.Count);
            Assert.True(profile.SupportedFrameworks.Contains(new FrameworkName(".NETFramework, Version=4.5")));
            Assert.True(profile.SupportedFrameworks.Contains(new FrameworkName("Silverlight, Version=4.0")));
            Assert.True(profile.SupportedFrameworks.Contains(new FrameworkName("WindowsPhone, Version=7.1")));
            Assert.True(profile.SupportedFrameworks.Contains(new FrameworkName("MonoTouch, Version=0.0")));
        }
コード例 #13
0
ファイル: NetPortableProfileTest.cs プロジェクト: rikoe/nuget
        public void TestParseWithStandardProfileString()
        {
            // Arrange & Act
            var profileCollection = new NetPortableProfileCollection();
            var profile1 = new NetPortableProfile(
               "Profile1",
               new[] { 
                           new FrameworkName(".NETFramework, Version=4.5"), 
                           new FrameworkName("Silverlight, Version=4.0"), 
                           new FrameworkName("WindowsPhone, Version=7.1"), 
                      });

            var profile2 = new NetPortableProfile(
               "Profile2",
               new[] { 
                           new FrameworkName(".NetCore, Version=4.5"), 
                           new FrameworkName("Silverlight, Version=3.0"), 
                           new FrameworkName("WindowsPhone, Version=7.1"), 
                      });
            profileCollection.Add(profile1);
            profileCollection.Add(profile2);

            var portableProfileTable = new NetPortableProfileTable(profileCollection);

            var profile = NetPortableProfile.Parse("Profile2", portableProfileTable: portableProfileTable);

            // Assert
            Assert.Equal(3, profile.SupportedFrameworks.Count);
            Assert.True(profile.SupportedFrameworks.Contains(new FrameworkName(".NetCore, Version=4.5")));
            Assert.True(profile.SupportedFrameworks.Contains(new FrameworkName("Silverlight, Version=3.0")));
            Assert.True(profile.SupportedFrameworks.Contains(new FrameworkName("WindowsPhone, Version=7.1")));
        }
コード例 #14
0
ファイル: NetPortableProfileTest.cs プロジェクト: rikoe/nuget
        public void TestIsCompatibleWithPortableProfile12WithMonoProjectWithMultipleInstalledProfileHavingMonoOfDifferentVersions()
        {
            // Arrange
            var profile1 = new NetPortableProfile(
               "Profile1",
               new[] { 
                           new FrameworkName(".NETFramework, Version=4.5"), 
                           new FrameworkName("Silverlight, Version=4.0"),
                           new FrameworkName("WindowsPhone, Version=7.1"),
                           new FrameworkName("Windows, Version=8.0"),
                      },
               new[] { 
                           new FrameworkName("MonoTouch, Version=1.0"), 
                           new FrameworkName("MonoAndroid, Version=3.0"),
                           new FrameworkName("MonoMac, Version=1.0"),
                      });

            var profile2 = new NetPortableProfile(
               "Profile2",
               new[] { 
                           new FrameworkName(".NETFramework, Version=4.5"), 
                           new FrameworkName("Silverlight, Version=4.0"),
                           new FrameworkName("WindowsPhone, Version=7.1"),
                           new FrameworkName("Windows, Version=8.0"),
                      },
               new[] { 
                           new FrameworkName("MonoAndroid, Version=1.0"),
                           new FrameworkName("MonoMac, Version=1.0"),
                      });

            var profile3 = new NetPortableProfile(
               "Profile3",
               new[] { 
                           new FrameworkName(".NETFramework, Version=4.5"), 
                           new FrameworkName("Silverlight, Version=4.5"),
                      },
               new[] { 
                           new FrameworkName("MonoAndroid, Version=3.0"),
                      });

            NetPortableProfileCollection profileCollection = new NetPortableProfileCollection();
            profileCollection.Add(profile1);
            profileCollection.Add(profile2);
            profileCollection.Add(profile3);

            var packageProfile = new NetPortableProfile(
                "ProfileXXX",
                new[] { 
                           new FrameworkName(".NETFramework, Version=4.0"), 
                           new FrameworkName("Silverlight, Version=4.0"),
                           new FrameworkName("WindowsPhone, Version=7.0"),
                           new FrameworkName("Windows, Version=8.0"),
                      });

            var projectProfile = new FrameworkName("MonoAndroid, Version=2.0");

            var portableProfileTable = new NetPortableProfileTable(profileCollection);

            // Act & Assert
            Assert.True(packageProfile.IsCompatibleWith(projectProfile, portableProfileTable));
        }
コード例 #15
0
ファイル: NetPortableProfileTest.cs プロジェクト: rikoe/nuget
        public void TestIsCompatibleWithPortableProfile11WithMonoProjectWithVersionLesserThanInstalledProfile()
        {
            // Arrange
            var profile1 = new NetPortableProfile(
               "Profile1",
               new[] { 
                           new FrameworkName(".NETFramework, Version=4.5"), 
                           new FrameworkName("Silverlight, Version=4.0"),
                           new FrameworkName("WindowsPhone, Version=7.1"),
                           new FrameworkName("Windows, Version=8.0"),
                      },
               new[] { 
                           new FrameworkName("MonoTouch, Version=1.0"), 
                           new FrameworkName("MonoAndroid, Version=2.0"),
                           new FrameworkName("MonoMac, Version=1.0"),
                      });

            NetPortableProfileCollection profileCollection = new NetPortableProfileCollection();
            profileCollection.Add(profile1);

            var packageProfile = new NetPortableProfile(
                "ProfileXXX",
                new[] { 
                           new FrameworkName(".NETFramework, Version=4.0"), 
                           new FrameworkName("Silverlight, Version=4.0"),
                           new FrameworkName("WindowsPhone, Version=7.0"),
                           new FrameworkName("Windows, Version=8.0"),
                      });

            var projectProfile = new FrameworkName("MonoAndroid, Version=1.0");

            var portableProfileTable = new NetPortableProfileTable(profileCollection);

            // Act & Assert
            Assert.False(packageProfile.IsCompatibleWith(projectProfile, portableProfileTable));
        }
コード例 #16
0
        public void TestIsCompatibleWithPortableProfile12WithMonoProjectWithMultipleInstalledProfileHavingMonoOfDifferentVersions()
        {
            // Arrange
            var profile1 = new NetPortableProfile(
                "Profile1",
                new[] {
                new FrameworkName(".NETFramework, Version=4.5"),
                new FrameworkName("Silverlight, Version=4.0"),
                new FrameworkName("WindowsPhone, Version=7.1"),
                new FrameworkName("Windows, Version=8.0"),
            },
                new[] {
                new FrameworkName("MonoTouch, Version=1.0"),
                new FrameworkName("MonoAndroid, Version=3.0"),
                new FrameworkName("MonoMac, Version=1.0"),
            });

            var profile2 = new NetPortableProfile(
                "Profile2",
                new[] {
                new FrameworkName(".NETFramework, Version=4.5"),
                new FrameworkName("Silverlight, Version=4.0"),
                new FrameworkName("WindowsPhone, Version=7.1"),
                new FrameworkName("Windows, Version=8.0"),
            },
                new[] {
                new FrameworkName("MonoAndroid, Version=1.0"),
                new FrameworkName("MonoMac, Version=1.0"),
            });

            var profile3 = new NetPortableProfile(
                "Profile3",
                new[] {
                new FrameworkName(".NETFramework, Version=4.5"),
                new FrameworkName("Silverlight, Version=4.5"),
            },
                new[] {
                new FrameworkName("MonoAndroid, Version=3.0"),
            });

            NetPortableProfileCollection profileCollection = new NetPortableProfileCollection();

            profileCollection.Add(profile1);
            profileCollection.Add(profile2);
            profileCollection.Add(profile3);

            var packageProfile = new NetPortableProfile(
                "ProfileXXX",
                new[] {
                new FrameworkName(".NETFramework, Version=4.0"),
                new FrameworkName("Silverlight, Version=4.0"),
                new FrameworkName("WindowsPhone, Version=7.0"),
                new FrameworkName("Windows, Version=8.0"),
            });

            var projectProfile = new FrameworkName("MonoAndroid, Version=2.0");

            var portableProfileTable = new NetPortableProfileTable(profileCollection);

            // Act & Assert
            Assert.True(packageProfile.IsCompatibleWith(projectProfile, portableProfileTable));
        }