public void ConcatStringInteger() { Assert.AreEqual("xxx1\r\n", TestHost.Execute("'xxx' + 1")); }
public void InstanceMemberAccess() { var result = TestHost.Execute(true, @"'xxx'.Length"); Assert.AreEqual("3" + Environment.NewLine, result); }
public void MemberCaseInsensitivy() { var result = TestHost.Execute(true, @"'xxx'.LENGTH"); Assert.AreEqual("3" + Environment.NewLine, result); }
public void NoParametersTest() { var result = TestHost.Execute(@"'a'.GetType().Name"); Assert.AreEqual(typeof(System.String).Name + Environment.NewLine, result); }
public void VariableAssignmentSubExpressionReturnsNull() { string result = TestHost.Execute("$($i = 10) -eq $null"); Assert.AreEqual("True" + Environment.NewLine, result); }
public void CallGetTypeMethodOnSystemEnvironmentOnWindows() { string result = TestHost.Execute("[Environment].GetType().FullName"); Assert.AreEqual("System.RuntimeType" + Environment.NewLine, result); }
public void StaticMethodOnBuiltinType() { var result = TestHost.Execute(true, @"[int]::Parse('7')"); Assert.AreEqual("7" + Environment.NewLine, result); }
public void VerbatimString() { Assert.AreEqual("xxx" + Environment.NewLine, TestHost.Execute("'xxx'")); }
public void ParametersByPrefix() { var results = TestHost.Execute("$a = 10; (Get-Variable -Nam a).ToString()"); Assert.AreEqual("$a = 10" + Environment.NewLine, results); }
public void AddIntegers() { Assert.AreEqual("3" + Environment.NewLine, TestHost.Execute("1 + 2")); }
public void ConcatStringInteger() { Assert.AreEqual("xxx1" + Environment.NewLine, TestHost.Execute("'xxx' + 1")); }
public void AddReals(string input, string result) { Assert.AreEqual(result + Environment.NewLine, TestHost.Execute(input)); }
public void EmptyPSObjectDoesntThrow(string fmtCmd) { Assert.DoesNotThrow(delegate { TestHost.Execute("New-Object psobject | " + fmtCmd); }); }
public void VerbatimString() { Assert.AreEqual("xxx\r\n", TestHost.Execute("'xxx'")); }
public void Section7_1_3_InvocationExpressions(params string[] input) { Assert.DoesNotThrow(delegate() { TestHost.Execute(input); }); }
public void ParametersByAliasPrefix() { Assert.DoesNotThrow(delegate() { TestHost.Execute("Get-Process -ProcessN mono"); }); }
public void TypeFullNamePropertyOnSystemEnvironment() { string result = TestHost.Execute("[Environment].FullName"); Assert.AreEqual("System.Environment" + Environment.NewLine, result); }
public void ParametersBySingleCharacterPrefix() { Assert.DoesNotThrow(delegate() { TestHost.Execute("Start-Sleep -S 0"); }); }
public void StaticMethodOnSystemType() { var result = TestHost.Execute(true, @"[System.Int32]::Parse('7')"); Assert.AreEqual("7" + Environment.NewLine, result); }
public void ParametersInvalid() { TestHost.Execute("Get-Process -Procecc mono"); }
public void StaticMethodAccessIsCaseInsensitive() { var result = TestHost.Execute(true, @"[Math]::abs(-15)"); Assert.AreEqual("15" + Environment.NewLine, result); }
public void SimpleIntegerLiteralVeryLargeNumberShouldBeDouble() { var result = TestHost.Execute(true, string.Format("({0}).GetType().Name", new string('9', 200))); Assert.AreEqual(typeof(System.Double).Name + Environment.NewLine, result); }
//[TestCase("$()", "")] // Ignore. Works with PowerShell. From spec "If statement-list is omitted, the result is $null." public void SingleStatementInSubExpression(string input, string expectedResult) { var result = TestHost.Execute(true, input); Assert.AreEqual(expectedResult + Environment.NewLine, result); }
public void SimpleIntegerLiteralVeryVeryVeryLargeNumberShouldThrow() { var result = TestHost.Execute(true, string.Format("({0}).GetType().Name", new string('9', 310))); StringAssert.Contains("Exception", result); }
public void Section7_1_3_InvocationExpressions(params string[] input) { var result = TestHost.Execute(input); }
public void LongIntegerLiteralLargeNumberShouldThrow(string typeSuffix) { var result = TestHost.Execute(true, string.Format("(9223372036854775808{0}).GetType()", typeSuffix)); StringAssert.Contains("Exception", result); }
public void FullNamePropertyOnType() { string result = TestHost.Execute("'abc'.GetType().FullName"); Assert.AreEqual("System.String" + Environment.NewLine, result); }
[TestCase("-9223372036854775808", typeof(System.Int64))] // long.MaxValue public void NegativeIntegerLiteralShouldBeOfType(string literal, Type expectedType) { var result = TestHost.Execute(true, string.Format("({0}).GetType().Name", literal)); Assert.AreEqual(expectedType.Name + Environment.NewLine, result); }
public void CallGetTypeOnTypeOnUnix() { string result = TestHost.Execute("'abc'.GetType().GetType().FullName"); Assert.AreEqual("System.MonoType" + Environment.NewLine, result); }
public void AddIntegers() { Assert.AreEqual("3\r\n", TestHost.Execute("1 + 2")); }