本文整理匯總了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"));
}