Browse Source

Add unit test that verifies that all AddIns shipping with SharpDevelop are addInManagerHidden="preinstalled"

pull/32/merge
Daniel Grunwald 12 years ago
parent
commit
d25b2dba4b
  1. 4
      samples/PortSD4AddInToSD5/PortSD4AddInToSD5.addin
  2. 1
      src/Main/Base/Test/ICSharpCode.SharpDevelop.Tests.csproj
  3. 59
      src/Main/Base/Test/SharpDevelopAddInTests.cs

4
samples/PortSD4AddInToSD5/PortSD4AddInToSD5.addin

@ -3,6 +3,10 @@ @@ -3,6 +3,10 @@
description = "Issue Providers that help porting SD4 AddIns to SD5"
addInManagerHidden="preinstalled">
<Manifest>
<Identity name = "PortSD4AddInToSD5" version = "@SharpDevelopCoreVersion"/>
</Manifest>
<Runtime>
<Import assembly = "PortSD4AddInToSD5.dll"/>
</Runtime>

1
src/Main/Base/Test/ICSharpCode.SharpDevelop.Tests.csproj

@ -122,6 +122,7 @@ @@ -122,6 +122,7 @@
<Compile Include="ServiceReferences\ServiceReferenceNodeTests.cs" />
<Compile Include="ServiceReferences\ServiceReferencesFolderNodeTests.cs" />
<Compile Include="ServiceReferences\ServiceReferencesProjectItemTests.cs" />
<Compile Include="SharpDevelopAddInTests.cs" />
<Compile Include="StringTagProvider\MockProjectForTagProvider.cs" />
<Compile Include="StringTagProvider\NullProjectStringTagProviderTestFixture.cs" />
<Compile Include="StringTagProvider\ProjectTagsTestFixture.cs" />

59
src/Main/Base/Test/SharpDevelopAddInTests.cs

@ -0,0 +1,59 @@ @@ -0,0 +1,59 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml.Linq;
using System.Linq;
using ICSharpCode.Core;
using NUnit.Framework;
namespace ICSharpCode.SharpDevelop
{
[TestFixture]
public class SharpDevelopAddInTests
{
List<XDocument> addInFiles;
[TestFixtureSetUp]
public void SetUp()
{
string dir = @"..\..\AddIns";
addInFiles = new List<XDocument>();
foreach (string file in Directory.GetFiles(dir, "*.addin", SearchOption.AllDirectories)) {
XDocument doc = XDocument.Load(file);
doc.AddAnnotation(FileName.Create(file));
addInFiles.Add(doc);
}
}
[Test]
public void FoundMainAddIn()
{
Assert.IsTrue(addInFiles.Any(addIn => addIn.Annotation<FileName>().GetFileName() == "ICSharpCode.SharpDevelop.addin"));
}
[Test]
public void IsPreinstalled()
{
foreach (var addIn in addInFiles) {
if (addIn.Annotation<FileName>().GetFileName() == "ICSharpCode.SharpDevelop.addin") {
Assert.AreEqual("true", (string)addIn.Root.Attribute("addInManagerHidden"));
} else {
Assert.AreEqual("preinstalled", (string)addIn.Root.Attribute("addInManagerHidden"));
}
}
}
[Test]
public void HaveIdentity()
{
foreach (var addIn in addInFiles) {
var manifest = addIn.Root.Element("Manifest");
Assert.IsNotNull(manifest, "<Manifest> missing in " + addIn.Annotation<FileName>());
Assert.IsNotNull(manifest.Element("Identity"), "<Identity> missing in " + addIn.Annotation<FileName>());
}
}
}
}
Loading…
Cancel
Save