Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MasterDevs.ChromeDevTools.ProtocolGenerator.Tests
{
[TestClass]
public class CommandTests
{
[TestMethod]
[DeploymentItem(DeploymentItems.Inspector10)]
[DeploymentItem(DeploymentItems.Protocol)]
public void EqualsTest()
{
var inspector10 = ProtocolProcessor.LoadProtocol(DeploymentItems.Inspector10, "inspector-1.0");
var protocol = ProtocolProcessor.LoadProtocol(DeploymentItems.Protocol, "protocol");
ProtocolProcessor.ResolveTypeReferences(inspector10);
ProtocolProcessor.ResolveTypeReferences(protocol);
var searchInResource10 = inspector10.GetDomain("Page").GetCommand("searchInResource");
var searchInResourceTip = protocol.GetDomain("Page").GetCommand("searchInResource");
// Quick fact check: both methods have the same string equivalent,
// ([] result) searchInResource(string frameId, string url, string query, boolean caseSensitive, boolean isRegex)
Assert.AreEqual<string>(searchInResource10.ToString(), searchInResourceTip.ToString());
// The result is a type, check whether the type has the same properties
var result10 = searchInResource10.Returns.Single();
var resultTip = searchInResourceTip.Returns.Single();
Assert.IsTrue(result10.Equals(resultTip));
Assert.IsTrue(searchInResource10.Equals(searchInResourceTip));
Assert.IsTrue(searchInResourceTip.Equals(searchInResource10));
}
}
}