本文整理汇总了C#中System.Reference.GetEnumerator方法的典型用法代码示例。如果您正苦于以下问题:C# Reference.GetEnumerator方法的具体用法?C# Reference.GetEnumerator怎么用?C# Reference.GetEnumerator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Reference
的用法示例。
在下文中一共展示了Reference.GetEnumerator方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FSharpProjectSystemRemoveReferenceFailsMultipleMatches
public void FSharpProjectSystemRemoveReferenceFailsMultipleMatches()
{
var project = new Mock<Project>();
project.Setup(p => p.Properties.Item("FullPath").Value).Returns("x:\\");
project.Setup(p => p.Name).Returns("Project");
var reference1 = new Mock<Reference>();
reference1.Setup(r => r.Name).Returns("AbC");
var reference2 = new Mock<Reference>();
reference2.Setup(r => r.Name).Returns("abc");
var enumerableReferences = new Reference[] { reference1.Object, reference2.Object };
var references = new Mock<References>();
references.Setup(s => s.Item(It.IsAny<object>())).Returns((Reference)null);
references.Setup(s => s.GetEnumerator()).Returns(enumerableReferences.GetEnumerator());
var fileSystem = new Mock<IFileSystem>();
var fileSystemProvider = new Mock<IFileSystemProvider>();
fileSystemProvider.Setup(f => f.GetFileSystem("x:\\")).Returns(fileSystem.Object);
var logger = new Mock<ILogger>();
FSharpProjectSystem projectSystem = new FSharpProjectSystem(project.Object, fileSystemProvider.Object);
projectSystem.Logger = logger.Object;
// Act
projectSystem.RemoveReferenceCore("aBc", references.Object);
// Assert
reference1.Verify(r => r.Remove(), Times.Never());
reference2.Verify(r => r.Remove(), Times.Never());
var message = String.Format(CultureInfo.CurrentCulture, VsResources.FailedToRemoveReference, "aBc");
logger.Verify(l => l.Log(MessageLevel.Error, message));
}
示例2: FSharpProjectSystemRemoveReferenceFailedToFindMatch
public void FSharpProjectSystemRemoveReferenceFailedToFindMatch()
{
var project = new Mock<Project>();
project.Setup(p => p.Properties.Item("FullPath").Value).Returns("x:\\");
project.Setup(p => p.Name).Returns("Project");
var reference = new Mock<Reference>();
reference.Setup(r => r.Name).Returns("AbC");
var enumerableReferences = new Reference[] { reference.Object };
var references = new Mock<References>();
references.Setup(s => s.Item(It.IsAny<object>())).Returns((Reference)null);
references.Setup(s => s.GetEnumerator()).Returns(enumerableReferences.GetEnumerator());
var fileSystem = new Mock<IFileSystem>();
var fileSystemProvider = new Mock<IFileSystemProvider>();
fileSystemProvider.Setup(f => f.GetFileSystem("x:\\")).Returns(fileSystem.Object);
var logger = new Mock<ILogger>();
FSharpProjectSystem projectSystem = new FSharpProjectSystem(project.Object, fileSystemProvider.Object);
projectSystem.Logger = logger.Object;
// Act
projectSystem.RemoveReferenceCore("aBcD", references.Object);
// Assert
reference.Verify(r => r.Remove(), Times.Never());
logger.Verify(l => l.Log(MessageLevel.Warning, VsResources.Warning_FailedToFindMatchForRemoveReference, "aBcD"));
}