Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eng/Common.globalconfig
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ dotnet_diagnostic.SA1217.severity = suggestion
dotnet_diagnostic.SA1300.severity = suggestion

# Interface names should begin with I
dotnet_diagnostic.SA1302.severity = suggestion
dotnet_diagnostic.SA1302.severity = warning

# Const field names should begin with upper-case letter
dotnet_diagnostic.SA1303.severity = suggestion
Expand Down
2 changes: 1 addition & 1 deletion src/Build.OM.UnitTests/Definition/ProjectItem_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3454,7 +3454,7 @@ public void UpdateAndRemoveShouldNotUseGlobMatchingOnEscapedGlobsFromReferencedI
return new Project(p, new Dictionary<string, string>(), MSBuildConstants.CurrentToolsVersion, c)
.Items
.Where(i => i.ItemType.Equals("i"))
.Select(i => (ObjectModelHelpers.TestItem)new ObjectModelHelpers.ProjectItemTestItemAdapter(i))
.Select(i => (ObjectModelHelpers.ITestItem)new ObjectModelHelpers.ProjectItemTestItemAdapter(i))
.ToList();
},
project,
Expand Down
2 changes: 1 addition & 1 deletion src/Build.UnitTests/BackEnd/IntrinsicTask_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3927,7 +3927,7 @@ internal static void AssertItemEvaluationFromTarget(string projectContents, stri
var lookup = new Lookup(new ItemDictionary<ProjectItemInstance>(), new PropertyDictionary<ProjectPropertyInstance>());
task.ExecuteTask(lookup);

return lookup.GetItems(itemType).Select(i => (ObjectModelHelpers.TestItem)new ObjectModelHelpers.ProjectItemInstanceTestItemAdapter(i)).ToList();
return lookup.GetItems(itemType).Select(i => (ObjectModelHelpers.ITestItem)new ObjectModelHelpers.ProjectItemInstanceTestItemAdapter(i)).ToList();
},
projectContents,
inputFiles,
Expand Down
20 changes: 10 additions & 10 deletions src/Shared/UnitTests/ObjectModelHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ internal static void AssertItemEvaluationFromProject(string projectContents, str
{
return new Project(p, new Dictionary<string, string>(), MSBuildConstants.CurrentToolsVersion, c)
.Items
.Select(i => (TestItem)new ProjectItemTestItemAdapter(i))
.Select(i => (ITestItem)new ProjectItemTestItemAdapter(i))
.ToList();
},
projectContents,
Expand All @@ -133,7 +133,7 @@ internal static void AssertItemEvaluationFromProject(string projectContents, str
normalizeSlashes);
}

internal static void AssertItemEvaluationFromGenericItemEvaluator(Func<string, ProjectCollection, IList<TestItem>> itemEvaluator, string projectContents, string[] inputFiles, string[] expectedInclude, bool makeExpectedIncludeAbsolute = false, Dictionary<string, string>[] expectedMetadataPerItem = null, bool normalizeSlashes = false)
internal static void AssertItemEvaluationFromGenericItemEvaluator(Func<string, ProjectCollection, IList<ITestItem>> itemEvaluator, string projectContents, string[] inputFiles, string[] expectedInclude, bool makeExpectedIncludeAbsolute = false, Dictionary<string, string>[] expectedMetadataPerItem = null, bool normalizeSlashes = false)
{
using (var env = TestEnvironment.Create())
using (var collection = new ProjectCollection())
Expand Down Expand Up @@ -197,14 +197,14 @@ internal static string NormalizeSlashes(string path)
}

// todo Make IItem<M> public and add these new members to it.
internal interface TestItem
internal interface ITestItem
{
string EvaluatedInclude { get; }
int DirectMetadataCount { get; }
string GetMetadataValue(string key);
}

internal class ProjectItemTestItemAdapter : TestItem
internal class ProjectItemTestItemAdapter : ITestItem
{
private readonly ProjectItem _projectInstance;

Expand All @@ -223,7 +223,7 @@ public static implicit operator ProjectItemTestItemAdapter(ProjectItem pi)
}
}

internal class ProjectItemInstanceTestItemAdapter : TestItem
internal class ProjectItemInstanceTestItemAdapter : ITestItem
{
private readonly ProjectItemInstance _projectInstance;

Expand All @@ -244,14 +244,14 @@ public static implicit operator ProjectItemInstanceTestItemAdapter(ProjectItemIn

internal static void AssertItems(string[] expectedItems, ICollection<ProjectItem> items, Dictionary<string, string> expectedDirectMetadata = null, bool normalizeSlashes = false)
{
var converteditems = items.Select(i => (TestItem)new ProjectItemTestItemAdapter(i)).ToList();
var converteditems = items.Select(i => (ITestItem)new ProjectItemTestItemAdapter(i)).ToList();
AssertItems(expectedItems, converteditems, expectedDirectMetadata, normalizeSlashes);
}

/// <summary>
/// Asserts that the list of items has the specified evaluated includes.
/// </summary>
internal static void AssertItems(string[] expectedItems, IList<TestItem> items, Dictionary<string, string> expectedDirectMetadata = null, bool normalizeSlashes = false)
internal static void AssertItems(string[] expectedItems, IList<ITestItem> items, Dictionary<string, string> expectedDirectMetadata = null, bool normalizeSlashes = false)
{
if (expectedDirectMetadata == null)
{
Expand All @@ -271,11 +271,11 @@ internal static void AssertItems(string[] expectedItems, IList<TestItem> items,

public static void AssertItems(string[] expectedItems, IList<ProjectItem> items, Dictionary<string, string>[] expectedDirectMetadataPerItem, bool normalizeSlashes = false)
{
var convertedItems = items.Select(i => (TestItem)new ProjectItemTestItemAdapter(i)).ToList();
var convertedItems = items.Select(i => (ITestItem)new ProjectItemTestItemAdapter(i)).ToList();
AssertItems(expectedItems, convertedItems, expectedDirectMetadataPerItem, normalizeSlashes);
}

public static void AssertItems(string[] expectedItems, IList<TestItem> items, Dictionary<string, string>[] expectedDirectMetadataPerItem, bool normalizeSlashes = false)
public static void AssertItems(string[] expectedItems, IList<ITestItem> items, Dictionary<string, string>[] expectedDirectMetadataPerItem, bool normalizeSlashes = false)
{
if (items.Count != 0 || expectedDirectMetadataPerItem.Length != 0)
{
Expand Down Expand Up @@ -467,7 +467,7 @@ internal static void AssertItemHasMetadata(string key, string value, ProjectItem
item.GetMetadataValue(key).ShouldBe(value);
}

internal static void AssertItemHasMetadata(Dictionary<string, string> expected, TestItem item)
internal static void AssertItemHasMetadata(Dictionary<string, string> expected, ITestItem item)
{
expected ??= new Dictionary<string, string>();

Expand Down
2 changes: 1 addition & 1 deletion src/Tasks/NativeMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public interface IFixedTypeInfo
[GuidAttribute("00020406-0000-0000-C000-000000000046")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
[ComImport]
internal interface UCOMICreateITypeLib
internal interface ICreateTypeLib
{
void CreateTypeInfo();
void SetName();
Expand Down
2 changes: 1 addition & 1 deletion src/Tasks/RegisterAssembly.cs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ private bool ExportTypeLib(Assembly asm, string typeLibFileName)
}

// Persist the type library
UCOMICreateITypeLib createTypeLib = (UCOMICreateITypeLib)convertedTypeLib;
ICreateTypeLib createTypeLib = (ICreateTypeLib)convertedTypeLib;

createTypeLib.SaveAllChanges();
}
Expand Down