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

Type: Fix TypeName property for arrays, add ToString method

parent 606abc78
No related branches found
No related tags found
No related merge requests found
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 TypeTests
{
[TestMethod]
[DeploymentItem(DeploymentItems.Inspector10)]
public void TypeNameTest()
{
Protocol p = ProtocolProcessor.LoadProtocol(DeploymentItems.Inspector10, "Chrome-1.0");
var evaluateCommand = p.GetDomain("Page").GetCommand("searchInResource");
var result = evaluateCommand.Returns.Single();
Assert.AreEqual("SearchMatch[]", result.TypeName.ToString());
}
[TestMethod]
[DeploymentItem(DeploymentItems.Inspector10)]
public void ToStringTest()
{
Protocol p = ProtocolProcessor.LoadProtocol(DeploymentItems.Inspector10, "Chrome-1.0");
var evaluateCommand = p.GetDomain("Page").GetCommand("searchInResource");
var result = evaluateCommand.Returns.Single();
var items = result.Items;
Assert.AreEqual("SearchMatch", items.ToString());
}
}
}
...@@ -75,7 +75,7 @@ namespace MasterDevs.ChromeDevTools.ProtocolGenerator ...@@ -75,7 +75,7 @@ namespace MasterDevs.ChromeDevTools.ProtocolGenerator
} }
else if (this.Items != null) else if (this.Items != null)
{ {
return this.Items.Name + "[]"; return this.Items.TypeName + "[]";
} }
else if (this.Kind != null && this.Kind != "object") else if (this.Kind != null && this.Kind != "object")
{ {
...@@ -158,5 +158,10 @@ namespace MasterDevs.ChromeDevTools.ProtocolGenerator ...@@ -158,5 +158,10 @@ namespace MasterDevs.ChromeDevTools.ProtocolGenerator
{ {
return string.Equals(this.Kind, "object", StringComparison.OrdinalIgnoreCase); return string.Equals(this.Kind, "object", StringComparison.OrdinalIgnoreCase);
} }
public override string ToString()
{
return this.TypeName;
}
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment