Ejemplo n.º 1
0
        public void LooksLikeCultureButIsnt()
        {
            AssignCulture t = new AssignCulture();
            t.BuildEngine = new MockEngine();
            ITaskItem i = new TaskItem("MyResource.yy.resx");
            t.Files = new ITaskItem[] { i };
            t.Execute();

            Assert.Equal(1, t.AssignedFiles.Length);
            Assert.Equal(1, t.CultureNeutralAssignedFiles.Length);
            Assert.Equal(String.Empty, t.AssignedFiles[0].GetMetadata("Culture"));
            Assert.Equal("MyResource.yy.resx", t.AssignedFiles[0].ItemSpec);
            Assert.Equal("MyResource.yy.resx", t.CultureNeutralAssignedFiles[0].ItemSpec);
        }
Ejemplo n.º 2
0
        public void Basic()
        {
            AssignCulture t = new AssignCulture();
            t.BuildEngine = new MockEngine();
            ITaskItem i = new TaskItem("MyResource.fr.resx");
            t.Files = new ITaskItem[] { i };
            t.Execute();

            Assert.Equal(1, t.AssignedFiles.Length);
            Assert.Equal(1, t.CultureNeutralAssignedFiles.Length);
            Assert.Equal("fr", t.AssignedFiles[0].GetMetadata("Culture"));
            Assert.Equal("MyResource.fr.resx", t.AssignedFiles[0].ItemSpec);
            Assert.Equal("MyResource.resx", t.CultureNeutralAssignedFiles[0].ItemSpec);
        }
Ejemplo n.º 3
0
        public void CultureAttributePrecedenceWithBogusCulture()
        {
            AssignCulture t = new AssignCulture();
            t.BuildEngine = new MockEngine();
            ITaskItem i = new TaskItem("MyResource.fr.resx");
            i.SetMetadata("Culture", "invalid");   // Bogus culture.
            t.Files = new ITaskItem[] { i };
            t.Execute();

            Assert.Equal(1, t.AssignedFiles.Length);
            Assert.Equal(1, t.CultureNeutralAssignedFiles.Length);
            Assert.Equal("fr", t.AssignedFiles[0].GetMetadata("Culture"));
            Assert.Equal("MyResource.fr.resx", t.AssignedFiles[0].ItemSpec);
            Assert.Equal("MyResource.resx", t.CultureNeutralAssignedFiles[0].ItemSpec);
        }
Ejemplo n.º 4
0
        public void Regress283991()
        {
            AssignCulture t = new AssignCulture();
            t.BuildEngine = new MockEngine();
            ITaskItem i = new TaskItem("MyResource.fr.resx");
            i.SetMetadata("DependentUpon", "MyResourcE.fr.vb");
            t.Files = new ITaskItem[] { i };

            t.Execute();

            Assert.Equal(1, t.AssignedFiles.Length);
            Assert.Equal(0, t.AssignedFilesWithCulture.Length);
            Assert.Equal(1, t.AssignedFilesWithNoCulture.Length);
        }
Ejemplo n.º 5
0
        public void AttributeForwarding()
        {
            AssignCulture t = new AssignCulture();
            t.BuildEngine = new MockEngine();
            ITaskItem i = new TaskItem("MyResource.fr.resx");
            i.SetMetadata("MyAttribute", "My Random String");
            t.Files = new ITaskItem[] { i };
            t.Execute();

            Assert.Equal(1, t.AssignedFiles.Length);
            Assert.Equal(1, t.CultureNeutralAssignedFiles.Length);
            Assert.Equal("fr", t.AssignedFiles[0].GetMetadata("Culture"));
            Assert.Equal("My Random String", t.AssignedFiles[0].GetMetadata("MyAttribute"));
            Assert.Equal("MyResource.fr.resx", t.AssignedFiles[0].ItemSpec);
            Assert.Equal("MyResource.resx", t.CultureNeutralAssignedFiles[0].ItemSpec);
        }