public void TwoItems()
        {
            var map = new TargetMapper();

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

            AreCollectionsEqual(new[] { "target1", "target2" }, map.GetNames("alias1"));
        }
        public void CaseInsensitiveTarget()
        {
            var map = new TargetMapper();

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

            Assert.Equal("target1", map.GetNames("alias1").Single());
        }
        public void VerifySingleAliasMappingValid()
        {
            var map = new TargetMapper();

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

            map.VerifySingleAlias();
        }
        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);
        }
        public void VerifySingleAliasMapping()
        {
            Assert.Throws(typeof(AliasMappedToMultipleNamesException), () =>
            {
                var map = new TargetMapper();

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

                map.VerifySingleAlias();
            });
        }
        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");
        }
        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);
        }