Skip to content
Snippets Groups Projects
Commit 9eb55f73 authored by Frederik Carlier's avatar Frederik Carlier
Browse files

Command: Don't compare the Handlers property when checking whether two...

Command: Don't compare the Handlers property when checking whether two commands are equal - this property is currentl ignored.
parent 7f9889ae
No related branches found
No related tags found
No related merge requests found
...@@ -11,31 +11,25 @@ namespace MasterDevs.ChromeDevTools.ProtocolGenerator.Tests ...@@ -11,31 +11,25 @@ namespace MasterDevs.ChromeDevTools.ProtocolGenerator.Tests
public class CommandTests public class CommandTests
{ {
[TestMethod] [TestMethod]
[DeploymentItem(DeploymentItems.Inspector10)] [DeploymentItem(DeploymentItems.Inspector11)]
[DeploymentItem(DeploymentItems.Protocol)] [DeploymentItem(DeploymentItems.Protocol)]
public void EqualsTest() public void EqualsTest()
{ {
var inspector10 = ProtocolProcessor.LoadProtocol(DeploymentItems.Inspector10, "inspector-1.0"); var inspector11 = ProtocolProcessor.LoadProtocol(DeploymentItems.Inspector11, "inspector-1.1");
var protocol = ProtocolProcessor.LoadProtocol(DeploymentItems.Protocol, "protocol"); var protocol = ProtocolProcessor.LoadProtocol(DeploymentItems.Protocol, "protocol");
ProtocolProcessor.ResolveTypeReferences(inspector10); ProtocolProcessor.ResolveTypeReferences(inspector11);
ProtocolProcessor.ResolveTypeReferences(protocol); ProtocolProcessor.ResolveTypeReferences(protocol);
var searchInResource10 = inspector10.GetDomain("Page").GetCommand("searchInResource"); var stopScreencast10 = inspector11.GetDomain("Page").GetCommand("stopScreencast");
var searchInResourceTip = protocol.GetDomain("Page").GetCommand("searchInResource"); var stopScreencastTip = protocol.GetDomain("Page").GetCommand("stopScreencast");
// Quick fact check: both methods have the same string equivalent, // Quick fact check: both methods have the same string equivalent,
// ([] result) searchInResource(string frameId, string url, string query, boolean caseSensitive, boolean isRegex) // void stopScreencast()
Assert.AreEqual<string>(searchInResource10.ToString(), searchInResourceTip.ToString()); Assert.AreEqual<string>(stopScreencast10.ToString(), stopScreencastTip.ToString());
// The result is a type, check whether the type has the same properties Assert.IsTrue(stopScreencast10.Equals(stopScreencastTip));
var result10 = searchInResource10.Returns.Single(); Assert.IsTrue(stopScreencastTip.Equals(stopScreencast10));
var resultTip = searchInResourceTip.Returns.Single();
Assert.IsTrue(result10.Equals(resultTip));
Assert.IsTrue(searchInResource10.Equals(searchInResourceTip));
Assert.IsTrue(searchInResourceTip.Equals(searchInResource10));
} }
} }
} }
...@@ -9,6 +9,7 @@ namespace MasterDevs.ChromeDevTools.ProtocolGenerator.Tests ...@@ -9,6 +9,7 @@ namespace MasterDevs.ChromeDevTools.ProtocolGenerator.Tests
class DeploymentItems class DeploymentItems
{ {
public const string Inspector10 = "Inspector-1.0.json"; public const string Inspector10 = "Inspector-1.0.json";
public const string Inspector11 = "Inspector-1.1.json";
public const string Protocol = "protocol.json"; public const string Protocol = "protocol.json";
} }
} }
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
<Compile Include="DeploymentItems.cs" /> <Compile Include="DeploymentItems.cs" />
<Compile Include="ProtocolProcessorTests.cs" /> <Compile Include="ProtocolProcessorTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TypeTests.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\ProtocolGenerator\MasterDevs.ChromeDevTools.ProtocolGenerator.csproj"> <ProjectReference Include="..\ProtocolGenerator\MasterDevs.ChromeDevTools.ProtocolGenerator.csproj">
......
...@@ -27,6 +27,9 @@ namespace MasterDevs.ChromeDevTools.ProtocolGenerator ...@@ -27,6 +27,9 @@ namespace MasterDevs.ChromeDevTools.ProtocolGenerator
set; set;
} }
/// <remarks>
/// This property is currently ignored.
/// </remarks>
public Collection<string> Handlers public Collection<string> Handlers
{ {
get; get;
...@@ -63,7 +66,6 @@ namespace MasterDevs.ChromeDevTools.ProtocolGenerator ...@@ -63,7 +66,6 @@ namespace MasterDevs.ChromeDevTools.ProtocolGenerator
bool equals = base.Equals(obj); bool equals = base.Equals(obj);
equals &= this.Returns.SequenceEqual(other.Returns); equals &= this.Returns.SequenceEqual(other.Returns);
equals &= Property.Equals(this.Error, other.Error); equals &= Property.Equals(this.Error, other.Error);
equals &= this.Handlers.CollectionEqual(other.Handlers);
equals &= this.Parameters.SequenceEqual(other.Parameters); equals &= this.Parameters.SequenceEqual(other.Parameters);
return equals; return equals;
} }
...@@ -80,7 +82,6 @@ namespace MasterDevs.ChromeDevTools.ProtocolGenerator ...@@ -80,7 +82,6 @@ namespace MasterDevs.ChromeDevTools.ProtocolGenerator
hash = hash * 23 + this.Error.GetHashCode(); hash = hash * 23 + this.Error.GetHashCode();
} }
hash = hash * 23 + this.Handlers.GetCollectionHashCode();
hash = hash * 23 + this.Parameters.GetCollectionHashCode(); hash = hash * 23 + this.Parameters.GetCollectionHashCode();
return hash; return hash;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment