Skip to content
Snippets Groups Projects
Select Git revision
  • 606abc780c49ebe58b417d119381902b18b8096f
  • master default
  • dependabot/nuget/source/Sample/Newtonsoft.Json-13.0.1
  • dependabot/nuget/source/MasterDevs.ChromeDevTools.Tests/Newtonsoft.Json-13.0.1
  • dependabot/nuget/source/ProtocolGenerator/Newtonsoft.Json-13.0.1
  • dependabot/nuget/source/ChromeDevTools/Newtonsoft.Json-13.0.1
  • dependabot/nuget/source/ChromeDevTools/System.Net.Http-4.3.4
  • revert-29-revert-24-protocol_62
  • revert-24-protocol_62
  • 1.1.0
  • 1.0.2
  • 1.0.1
  • 1.0.0.40915
13 results

CommandTests.cs

  • CommandTests.cs 1.69 KiB
    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));
            }
        }
    }