Пример #1
0
        public void TwoItems()
        {
            var map = new TargetMapper();

            map.AddAlias("alias1", "target1");
            map.AddAlias("alias1", "target2");

            AreCollectionsEqual(new[] { "target1", "target2" }, map.GetNames("alias1"));
        }
Пример #2
0
        public void CaseInsensitiveTarget()
        {
            var map = new TargetMapper();

            map.AddAlias("alias1", "target1");
            map.AddAlias("alias1", "Target1");

            Assert.Equal("target1", map.GetNames("alias1").Single());
        }
Пример #3
0
        public void VerifySingleAliasMappingValid()
        {
            var map = new TargetMapper();

            map.AddAlias("alias1", "name1");
            map.AddAlias("alias2", "name2");

            map.VerifySingleAlias();
        }
Пример #4
0
        public void AliasList()
        {
            var map = new TargetMapper();

            map.AddAlias("alias1", "Target1");
            map.AddAlias("alias2", "target1");
            map.AddAlias("Alias1", "target2");

            AreCollectionsEqual(new[] { "alias1", "alias2" }, map.Aliases);
        }
Пример #5
0
        public void VerifySingleAliasMapping()
        {
            Assert.Throws(typeof(AliasMappedToMultipleNamesException), () =>
            {
                var map = new TargetMapper();

                map.AddAlias("alias", "name1");
                map.AddAlias("alias", "name2");

                map.VerifySingleAlias();
            });
        }
Пример #6
0
        public void AliasEqualsTarget()
        {
            var map = new TargetMapper();

            map.AddAlias("TestTarget2", "TestTarget1");

            try
            {
                map.AddAlias("ProjectAlias", "TestTarget2");
            }
            catch (TargetMapperException e)
            {
                Assert.Equal(String.Format(CultureInfo.CurrentCulture, LocalizedStrings.AliasCanotBeEqualToTargetNameError, "TestTarget2"), e.Message);
                return;
            }

            Assert.True(false, "Expected exception was not thrown");
        }
Пример #7
0
        public void GetTargetNamesForDistinctTargets()
        {
            var mapper = new TargetMapper();

            mapper.AddAlias("Mobile", "Windows Phone");
            mapper.AddAlias("Mobile", "Windows");
            mapper.AddAlias("Mobile", "Mono");
            mapper.AddAlias("Desktop", ".NET Framework Test");

            var netFramework4 = new FrameworkName(".NET Framework,Version=4.0");
            var windowsPhone  = new FrameworkName("Windows Phone,Version=8.1");
            var windows8      = new FrameworkName("Windows,Version=8.0");

            var targets = new List <FrameworkName> {
                netFramework4, windowsPhone, windows8
            };
            var targetNames             = mapper.GetTargetNames(targets, includeVersion: false).ToArray();
            var targetNamesWithVersions = mapper.GetTargetNames(targets, includeVersion: true).ToArray();

            AreCollectionsEqual(new string[] { ".NET Framework", "Windows Phone", "Windows" }, targetNames);
            AreCollectionsEqual(new string[] { netFramework4.FullName, windowsPhone.FullName, windows8.FullName }, targetNamesWithVersions);
        }