Merge pull request #6 from unoplatform/dev/jela/fix-return-type
Fix return type validation
This commit is contained in:
Коммит
80d22b3228
|
@ -71,9 +71,7 @@ jobs:
|
|||
clean: all
|
||||
|
||||
pool:
|
||||
name: Default
|
||||
demands:
|
||||
- agent.os -equals Linux
|
||||
vmImage: 'ubuntu-18.04'
|
||||
|
||||
variables:
|
||||
NUGET_PACKAGES: $(Agent.WorkFolder)/.nuget
|
||||
|
|
14
README.md
14
README.md
|
@ -7,7 +7,7 @@ published nuget package (in nuget.org) and a local NuGet package.
|
|||
|
||||
## Installing
|
||||
|
||||
Run the following command from commandline (requires .NET Core 2.1 installed):
|
||||
Run the following command from command line (requires .NET Core 2.1 installed):
|
||||
|
||||
```
|
||||
dotnet tool install --global Uno.PackageDiff
|
||||
|
@ -32,22 +32,22 @@ Here's the format:
|
|||
<IgnoreSets>
|
||||
<IgnoreSet baseVersion="1.0.0">
|
||||
<Types>
|
||||
<Member fullName="MyNamespace.MyMissingClass"/>
|
||||
<Member fullName="MyNamespace.MyMissingClass" />
|
||||
</Types>
|
||||
<Properties>
|
||||
<Member fullName="MyNamespace.MyClass.MyProperty"/>
|
||||
<Member fullName="MyNamespace.MyClass.MyProperty" />
|
||||
</Properties>
|
||||
<Fields>
|
||||
<Member fullName="MyNamespace.MyClass.myField"/>
|
||||
<Member fullName="MyNamespace.MyClass.myField" />
|
||||
</Fields>
|
||||
<Events>
|
||||
<Member fullName="MyNamespace.MyClass.MyEvent"/>
|
||||
<Member fullName="MyNamespace.MyClass.MyEvent" />
|
||||
</Events>
|
||||
<Methods>
|
||||
<Member fullName="MyNamespace.MyClass.MyMethod"/>
|
||||
<Member fullName="MyNamespace.MyClass.MyMethod" />
|
||||
</Methods>
|
||||
<Methods>
|
||||
<Member fullName="MyNamespace.MyClass.MyMethod"/>
|
||||
<Member fullName="MyNamespace.MyClass.MyMethod" />
|
||||
</Methods>
|
||||
</IgnoreSet>
|
||||
</IgnoreSets>
|
||||
|
|
|
@ -81,5 +81,22 @@ namespace Uno.PackageDiff.Tests
|
|||
Assert.AreEqual("System.Void Uno.PackageDiff.Tests.Sources.When_Target_Internal::set_MyProperty(System.Int32)", r.InvalidMethods.ElementAt(1).ToString());
|
||||
Assert.AreEqual("System.Void Uno.PackageDiff.Tests.Sources.When_Target_Internal::MyMethod()", r.InvalidMethods.ElementAt(2).ToString());
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void When_Target_Method_ChangedReturnType()
|
||||
{
|
||||
var context = _builder.BuildAssemblies();
|
||||
|
||||
var r = AssemblyComparer.CompareTypes(context.BaseAssembly, context.TargetAssembly);
|
||||
|
||||
Assert.AreEqual(0, r.InvalidTypes.Length);
|
||||
Assert.AreEqual(0, r.InvalidEvents.Length);
|
||||
Assert.AreEqual(0, r.InvalidFields.Length);
|
||||
Assert.AreEqual(1, r.InvalidMethods.Length);
|
||||
Assert.AreEqual(0, r.InvalidProperties.Length);
|
||||
|
||||
Assert.AreEqual("TestMethod", r.InvalidMethods.ElementAt(0).Name);
|
||||
Assert.AreEqual("System.Threading.Tasks.Task Uno.PackageDiff.Tests.Sources.When_Target_Method_ChangedReturnType::TestMethod()", r.InvalidMethods.ElementAt(0).ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Uno.PackageDiff.Tests.Sources
|
||||
{
|
||||
public class When_Target_Method_ChangedReturnType
|
||||
{
|
||||
public void VoidMethod() { }
|
||||
public int IntMethod() => 0;
|
||||
public async Task TestMethod() { }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Uno.PackageDiff.Tests.Sources
|
||||
{
|
||||
public class When_Target_Method_ChangedReturnType
|
||||
{
|
||||
public void VoidMethod() { }
|
||||
public int IntMethod() => 0;
|
||||
public async Task<bool> TestMethod() { return false; }
|
||||
}
|
||||
}
|
|
@ -73,6 +73,7 @@ namespace Uno.PackageDiff
|
|||
where !type.sourceType.Methods
|
||||
.Any(sourceMethod =>
|
||||
sourceMethod.Name == targetMethod.Name
|
||||
&& targetMethod.ReturnType.FullName == sourceMethod.ReturnType.FullName
|
||||
&& targetMethodParams.SequenceEqual(getMethodParamsSignature(sourceMethod))
|
||||
&& IsVisibleMethod(sourceMethod)
|
||||
&& targetMethod.IsVirtual == sourceMethod.IsVirtual)
|
||||
|
|
Загрузка…
Ссылка в новой задаче