本文整理汇总了C#中ICSharpCode.SharpDevelop.Project.ReferenceProjectItem类的典型用法代码示例。如果您正苦于以下问题:C# ReferenceProjectItem类的具体用法?C# ReferenceProjectItem怎么用?C# ReferenceProjectItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ReferenceProjectItem类属于ICSharpCode.SharpDevelop.Project命名空间,在下文中一共展示了ReferenceProjectItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
public void Init()
{
resultChangedCalled = false;
classesAdded = new List<TestClass>();
classesRemoved = new List<TestClass>();
// Create a project.
project = new MockCSharpProject();
project.Name = "TestProject";
ReferenceProjectItem nunitFrameworkReferenceItem = new ReferenceProjectItem(project);
nunitFrameworkReferenceItem.Include = "NUnit.Framework";
ProjectService.AddProjectItem(project, nunitFrameworkReferenceItem);
// Add a test class with a TestFixture attributes.
projectContent = new MockProjectContent();
projectContent.Language = LanguageProperties.None;
MockClass c = new MockClass(projectContent, "RootNamespace.MyTestFixture");
c.SetCompoundClass(c);
c.Attributes.Add(new MockAttribute("TestFixture"));
projectContent.Classes.Add(c);
// Add a second class that has no test fixture attribute.
MockClass nonTestClass = new MockClass(projectContent);
projectContent.Classes.Add(nonTestClass);
testFrameworks = new MockTestFrameworksWithNUnitFrameworkSupport();
testProject = new TestProject(project, projectContent, testFrameworks);
testProject.TestClasses.TestClassAdded += TestClassAdded;
testProject.TestClasses.TestClassRemoved += TestClassRemoved;
testClass = testProject.TestClasses[0];
}
示例2: SetUpFixture
public void SetUpFixture()
{
project = WebReferenceTestHelper.CreateTestProject("C#");
project.FileName = FileName.Create("C:\\projects\\test\\foo.csproj");
protocol = new DiscoveryClientProtocol();
DiscoveryDocumentReference discoveryRef = new DiscoveryDocumentReference();
discoveryRef.Url = updateFromUrl;
protocol.References.Add(discoveryRef);
ContractReference contractRef = new ContractReference();
contractRef.Url = "http://localhost/test.asmx?wsdl";
contractRef.ClientProtocol = new DiscoveryClientProtocol();
ServiceDescription desc = new ServiceDescription();
contractRef.ClientProtocol.Documents.Add(contractRef.Url, desc);
protocol.References.Add(contractRef);
WebReferenceTestHelper.InitializeProjectBindings();
webReference = new SD.WebReference(project, updateFromUrl, name, proxyNamespace, protocol);
webReferenceUrl = webReference.WebReferenceUrl;
discoFileProjectItem = WebReferenceTestHelper.GetFileProjectItem(webReference.Items, "Web References\\localhost\\test.disco", ItemType.None);
referenceMapFileProjectItem = WebReferenceTestHelper.GetFileProjectItem(webReference.Items, "Web References\\localhost\\Reference.map", ItemType.None);
wsdlFileProjectItem = WebReferenceTestHelper.GetFileProjectItem(webReference.Items, "Web References\\localhost\\test.wsdl", ItemType.None);
proxyFileProjectItem = WebReferenceTestHelper.GetFileProjectItem(webReference.Items, "Web References\\localhost\\Reference.cs", ItemType.Compile);
webReferencesProjectItem = (WebReferencesProjectItem)WebReferenceTestHelper.GetProjectItem(webReference.Items, "Web References\\", ItemType.WebReferences);
webServicesReferenceProjectItem = (ReferenceProjectItem)WebReferenceTestHelper.GetProjectItem(webReference.Items, ItemType.Reference);
}
示例3: Init
public void Init()
{
resultChangedCalled = false;
IProject project = new MockCSharpProject();
project.Name = "TestProject";
ReferenceProjectItem nunitFrameworkReferenceItem = new ReferenceProjectItem(project);
nunitFrameworkReferenceItem.Include = "NUnit.Framework";
ProjectService.AddProjectItem(project, nunitFrameworkReferenceItem);
projectContent = new MockProjectContent();
projectContent.Language = LanguageProperties.None;
MockClass mockClass = new MockClass("RootNamespace.Tests.MyTestFixture");
mockClass.Namespace = "RootNamespace.Tests";
mockClass.ProjectContent = projectContent;
mockClass.Attributes.Add(new MockAttribute("TestFixture"));
projectContent.Classes.Add(mockClass);
// Add a method to the test class
MockMethod mockMethod = new MockMethod("TestMethod");
mockMethod.DeclaringType = mockClass;
mockMethod.Attributes.Add(new MockAttribute("Test"));
mockClass.Methods.Add(mockMethod);
testProject = new TestProject(project, projectContent);
testClass = testProject.TestClasses[0];
testMethod = testClass.TestMethods[0];
}
示例4: SetUp
public void SetUp()
{
testFrameworks = new MockTestFrameworksWithNUnitFrameworkSupport();
treeView = new DummyParserServiceTestTreeView(testFrameworks);
// Create a solution with two test projects.
solution = new Solution(new MockProjectChangeWatcher());
// Create the first test project.
firstProject = new MockCSharpProject(solution, "FirstTestProject");
ReferenceProjectItem nunitFrameworkReferenceItem = new ReferenceProjectItem(firstProject);
nunitFrameworkReferenceItem.Include = "NUnit.Framework";
ProjectService.AddProjectItem(firstProject, nunitFrameworkReferenceItem);
// Create the second test project.
secondProject = new MockCSharpProject(solution, "SecondTestProject");
nunitFrameworkReferenceItem = new ReferenceProjectItem(secondProject);
nunitFrameworkReferenceItem.Include = "NUnit.Framework";
ProjectService.AddProjectItem(secondProject, nunitFrameworkReferenceItem);
// Add the projects to the solution.
solution.Folders.Add(firstProject);
solution.Folders.Add(secondProject);
// Create a dummy project content so the projects will be added
// to the tree.
treeView.ProjectContentForProject = new MockProjectContent();
// Add the solution to the tree.
treeView.AddSolution(solution);
allTestsTreeNode = treeView.Nodes[0] as AllTestsTreeNode;
firstTestProject = treeView.GetTestProject(firstProject);
secondTestProject = treeView.GetTestProject(secondProject);
}
示例5: FixtureSetUp
public override void FixtureSetUp()
{
base.FixtureSetUp();
// Set up the project.
MSBuildBasedProject project = WebReferenceTestHelper.CreateTestProject("C#");
project.FileName = FileName.Create("c:\\projects\\test\\foo.csproj");
// Web references item.
WebReferencesProjectItem webReferencesItem = new WebReferencesProjectItem(project);
webReferencesItem.Include = "Web References\\";
ProjectService.AddProjectItem(project, webReferencesItem);
// Web reference url.
WebReferenceUrl webReferenceUrl = new WebReferenceUrl(project);
webReferenceUrl.Include = "http://localhost/test.asmx";
webReferenceUrl.UpdateFromURL = "http://localhost/test.asmx";
webReferenceUrl.RelPath = "Web References\\localhost";
ProjectService.AddProjectItem(project, webReferenceUrl);
FileProjectItem discoFileItem = new FileProjectItem(project, ItemType.None);
discoFileItem.Include = "Web References\\localhost\\test.disco";
ProjectService.AddProjectItem(project, discoFileItem);
FileProjectItem wsdlFileItem = new FileProjectItem(project, ItemType.None);
wsdlFileItem.Include = "Web References\\localhost\\test.wsdl";
ProjectService.AddProjectItem(project, wsdlFileItem);
// Proxy
FileProjectItem proxyItem = new FileProjectItem(project, ItemType.Compile);
proxyItem.Include = "Web References\\localhost\\Reference.cs";
proxyItem.DependentUpon = "Reference.map";
ProjectService.AddProjectItem(project, proxyItem);
// Reference map.
FileProjectItem mapItem = new FileProjectItem(project, ItemType.None);
mapItem.Include = "Web References\\localhost\\Reference.map";
ProjectService.AddProjectItem(project, mapItem);
// System.Web.Services reference.
ReferenceProjectItem webServicesReferenceItem = new ReferenceProjectItem(project, "System.Web.Services");
ProjectService.AddProjectItem(project, webServicesReferenceItem);
// Set up the web reference.
DiscoveryClientProtocol protocol = new DiscoveryClientProtocol();
DiscoveryDocumentReference discoveryRef = new DiscoveryDocumentReference();
discoveryRef.Url = "http://localhost/new.asmx";
protocol.References.Add(discoveryRef);
ContractReference contractRef = new ContractReference();
contractRef.Url = "http://localhost/new.asmx?wsdl";
contractRef.ClientProtocol = new DiscoveryClientProtocol();
ServiceDescription desc = new ServiceDescription();
contractRef.ClientProtocol.Documents.Add(contractRef.Url, desc);
protocol.References.Add(contractRef);
WebReferenceTestHelper.InitializeProjectBindings();
var webReference = new Gui.WebReference(project, "http://localhost/new.asmx", "localhost", "ProxyNamespace", protocol);
changes = webReference.GetChanges(project);
}
示例6: Init
public void Init()
{
// Create a project to display.
project = new MockCSharpProject();
project.Name = "TestProject";
ReferenceProjectItem nunitFrameworkReferenceItem = new ReferenceProjectItem(project);
nunitFrameworkReferenceItem.Include = "NUnit.Framework";
ProjectService.AddProjectItem(project, nunitFrameworkReferenceItem);
// Add a test class.
projectContent = new MockProjectContent();
projectContent.Language = LanguageProperties.None;
MockClass c = new MockClass("RootNamespace.MyTestFixture");
c.Attributes.Add(new MockAttribute("TestFixture"));
c.ProjectContent = projectContent;
projectContent.Classes.Add(c);
// Add a second class with the same name.
MockClass secondTestClass = new MockClass("RootNamespace.MyTestFixture");
secondTestClass.ProjectContent = projectContent;
secondTestClass.Attributes.Add(new MockAttribute("TestFixture"));
projectContent.Classes.Add(secondTestClass);
testProject = new TestProject(project, projectContent);
}
示例7: Init
public void Init()
{
solution = new Solution();
project1 = new MockCSharpProject(solution);
project1.Name = "A";
ReferenceProjectItem refProjectItem = new ReferenceProjectItem(project1);
refProjectItem.Include = "NUnit.Framework";
ProjectService.AddProjectItem(project1, refProjectItem);
solution.Folders.Add(project1);
project2 = new MockCSharpProject(solution);
project2.Name = "Z";
refProjectItem = new ReferenceProjectItem(project2);
refProjectItem.Include = "NUnit.Framework";
ProjectService.AddProjectItem(project2, refProjectItem);
solution.Folders.Add(project2);
MockProjectContent projectContent = new MockProjectContent();
projectContent.Project = project1;
treeView = new DummyParserServiceTestTreeView();
treeView.ProjectContentForProject = projectContent;
treeView.AddSolution(solution);
projects = treeView.GetProjects();
}
示例8: Init
public void Init()
{
IProject project = new MockCSharpProject();
project.Name = "TestProject";
ReferenceProjectItem nunitFrameworkReferenceItem = new ReferenceProjectItem(project);
nunitFrameworkReferenceItem.Include = "NUnit.Framework";
ProjectService.AddProjectItem(project, nunitFrameworkReferenceItem);
MockProjectContent projectContent = new MockProjectContent();
projectContent.Language = LanguageProperties.None;
mockClass = new MockClass(projectContent, "RootNamespace.Tests.MyTestFixture");
mockClass.Attributes.Add(new MockAttribute("TestFixture"));
projectContent.Classes.Add(mockClass);
// Add a method to the test class
MockMethod mockMethod = new MockMethod(mockClass, "TestMethod1");
mockMethod.Attributes.Add(new MockAttribute("Test"));
mockClass.Methods.Add(mockMethod);
mockMethod = new MockMethod(mockClass, "TestMethod2");
mockMethod.Attributes.Add(new MockAttribute("Test"));
mockClass.Methods.Add(mockMethod);
testFrameworks = new MockTestFrameworksWithNUnitFrameworkSupport();
testProject = new TestProject(project, projectContent, testFrameworks);
testClass = testProject.TestClasses[0];
testMethod1 = testClass.TestMembers[0];
testMethod2 = testClass.TestMembers[1];
}
示例9: SetUpFixture
public void SetUpFixture()
{
project = WebReferenceTestHelper.CreateTestProject("C#");
project.FileName = "C:\\projects\\test\\foo.csproj";
ReferenceProjectItem referenceItem = new ReferenceProjectItem(project, "System.Web.Services");
ProjectService.AddProjectItem(project, referenceItem);
protocol = new DiscoveryClientProtocol();
DiscoveryDocumentReference discoveryRef = new DiscoveryDocumentReference();
discoveryRef.Url = updateFromUrl;
protocol.References.Add(discoveryRef);
ContractReference contractRef = new ContractReference();
contractRef.Url = "http://localhost/test.asmx?wsdl";
contractRef.ClientProtocol = new DiscoveryClientProtocol();
ServiceDescription desc = new ServiceDescription();
contractRef.ClientProtocol.Documents.Add(contractRef.Url, desc);
protocol.References.Add(contractRef);
WebReferenceTestHelper.InitializeLanguageBindings();
webReference = new SD.WebReference(project, updateFromUrl, name, proxyNamespace, protocol);
webServicesReferenceProjectItem = (ReferenceProjectItem)WebReferenceTestHelper.GetProjectItem(webReference.Items, ItemType.Reference);
}
示例10: IsTestFrameworkReference
/// <summary>
/// Determines whether the specified reference is a reference to
/// a test framework. Currently only references to the
/// NUnit.Framework return true.
/// </summary>
public static bool IsTestFrameworkReference(ReferenceProjectItem referenceProjectItem)
{
if (referenceProjectItem != null) {
return string.Equals(referenceProjectItem.ShortName, "NUnit.Framework", StringComparison.OrdinalIgnoreCase);
}
return false;
}
示例11: AreEqual
public static void AreEqual(ReferenceProjectItem expectedReferenceItem, ReferenceProjectItem actualReferenceItem)
{
string[] expectedValues = GetReferenceProjectItemAsStrings(expectedReferenceItem);
string[] actualValues = GetReferenceProjectItemAsStrings(actualReferenceItem);
Assert.AreEqual(expectedValues, actualValues);
}
示例12: SetUp
public void SetUp()
{
solution = new Solution();
// Create a project to display in the test tree view.
project = new MockCSharpProject(solution, "TestProject");
ReferenceProjectItem nunitFrameworkReferenceItem = new ReferenceProjectItem(project);
nunitFrameworkReferenceItem.Include = "NUnit.Framework";
ProjectService.AddProjectItem(project, nunitFrameworkReferenceItem);
// Add a test class with a TestFixture attributes.
projectContent = new MockProjectContent();
projectContent.Language = LanguageProperties.None;
testClass1 = new MockClass(projectContent, "Project.Tests.MyTestFixture");
testClass1.Attributes.Add(new MockAttribute("TestFixture"));
projectContent.Classes.Add(testClass1);
testClass2 = new MockClass(projectContent, "Project.MyTestFixture");
testClass2.Attributes.Add(new MockAttribute("TestFixture"));
projectContent.Classes.Add(testClass2);
testFrameworks = new MockTestFrameworksWithNUnitFrameworkSupport();
dummyTreeView = new DummyParserServiceTestTreeView(testFrameworks);
dummyTreeView.ProjectContentForProject = projectContent;
// Load the projects into the test tree view.
treeView = dummyTreeView as TestTreeView;
solution.Folders.Add(project);
treeView.AddSolution(solution);
nodes = treeView.Nodes;
rootNode = (ExtTreeNode)treeView.Nodes[0];
treeView.SelectedNode = rootNode;
testProject = treeView.SelectedTestProject;
}
示例13: Init
public void Init()
{
// Create a project to display in the test tree view.
IProject project = new MockCSharpProject();
project.Name = "TestProject";
ReferenceProjectItem nunitFrameworkReferenceItem = new ReferenceProjectItem(project);
nunitFrameworkReferenceItem.Include = "NUnit.Framework";
ProjectService.AddProjectItem(project, nunitFrameworkReferenceItem);
// Add a test class with a TestFixture attributes.
MockProjectContent projectContent = new MockProjectContent();
projectContent.Language = LanguageProperties.None;
MockClass c = new MockClass("RootNamespace.MyTestFixture");
c.Namespace = "RootNamespace";
c.Attributes.Add(new MockAttribute("TestFixture"));
c.ProjectContent = projectContent;
projectContent.Classes.Add(c);
// Add a second class no root namespace.
c = new MockClass("MyTestFixture2");
c.Namespace = String.Empty;
c.Attributes.Add(new MockAttribute("TestFixture"));
c.ProjectContent = projectContent;
projectContent.Classes.Add(c);
testProject = new TestProject(project, projectContent);
}
示例14: CreateReference
ReferenceProjectItem CreateReference(string referencePath)
{
var assemblyReference = new ReferenceProjectItem(project);
assemblyReference.Include = Path.GetFileNameWithoutExtension(referencePath);
assemblyReference.HintPath = referencePath;
return assemblyReference;
}
示例15: SetUpFixture
public void SetUpFixture()
{
WixProject p = WixBindingTestsHelper.CreateEmptyWixProject();
FileProjectItem item = new FileProjectItem(p, ItemType.None);
item.Include = "readme.txt";
ProjectService.AddProjectItem(p, item);
ReferenceProjectItem referenceItem = new ReferenceProjectItem(p);
referenceItem.Include = "System.Windows.Forms";
ProjectService.AddProjectItem(p, referenceItem);
item = new FileProjectItem(p, ItemType.Compile);
item.Include = "setup.wxs";
ProjectService.AddProjectItem(p, item);
item = new FileProjectItem(p, ItemType.Compile);
item.Include = "test.wxi";
ProjectService.AddProjectItem(p, item);
item = new FileProjectItem(p, ItemType.Compile);
item.Include = "dialogs.wxs";
ProjectService.AddProjectItem(p, item);
wixFileProjectItemCount = 0;
foreach (FileProjectItem fileItem in p.WixSourceFiles) {
wixFileProjectItemCount++;
}
wixSetupFile = p.WixSourceFiles[0];
wixDialogsFile = p.WixSourceFiles[1];
}