mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-08-18 13:31:41 +02:00
Configuration
Core
Data
Plugins
Properties
Resources
Updates
bld
lib
subprocess
tests
Core
TestBrowserUtils.cs
TestCommandLineArgsParser.cs
TestStringUtils.cs
Data
Properties
TestUtils.cs
UnitTests.csproj
.gitignore
LICENSE.md
Program.cs
README.md
Reporter.cs
TweetDuck.csproj
TweetDuck.sln
TweetDuck.sln.DotSettings
_postbuild.bat
packages.config
34 lines
1.4 KiB
C#
34 lines
1.4 KiB
C#
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
using TweetDuck.Core.Utils;
|
|
using TweetDuck.Data;
|
|
|
|
namespace UnitTests.Core{
|
|
[TestClass]
|
|
public class TestCommandLineArgsParser{
|
|
[TestMethod]
|
|
public void TestEmptyString(){
|
|
Assert.AreEqual(0, CommandLineArgsParser.ReadCefArguments("").Count);
|
|
Assert.AreEqual(0, CommandLineArgsParser.ReadCefArguments(" ").Count);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TestValidString(){
|
|
CommandLineArgs args = CommandLineArgsParser.ReadCefArguments("--aaa --bbb --first-value=123 --SECOND-VALUE=\"a b c d e\"\r\n--ccc");
|
|
// cef has no flags, flag arguments have a value of 1
|
|
// the processing removes all dashes in front of each key
|
|
|
|
Assert.AreEqual(5, args.Count);
|
|
Assert.IsTrue(args.HasValue("aaa"));
|
|
Assert.IsTrue(args.HasValue("bbb"));
|
|
Assert.IsTrue(args.HasValue("ccc"));
|
|
Assert.IsTrue(args.HasValue("first-value"));
|
|
Assert.IsTrue(args.HasValue("second-value"));
|
|
Assert.AreEqual("1", args.GetValue("aaa", string.Empty));
|
|
Assert.AreEqual("1", args.GetValue("bbb", string.Empty));
|
|
Assert.AreEqual("1", args.GetValue("ccc", string.Empty));
|
|
Assert.AreEqual("123", args.GetValue("first-value", string.Empty));
|
|
Assert.AreEqual("a b c d e", args.GetValue("second-value", string.Empty));
|
|
}
|
|
}
|
|
}
|