程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> C語言 >> 關於C語言 >> 簡單的在線C# IDE例子(3)

簡單的在線C# IDE例子(3)

編輯:關於C語言

測試:

using VSOnline.Framework;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Collections.Generic;
using System;
using FastDev.Core;
using System.Linq;
namespace Test
{
[TestClass()]
public class CodeRunTest
{
[TestMethod()]
public void RunTest()
{
CodeRun target = new CodeRun();
string code = @"
using System;
public class Program
{
public static void Main()
{
for(int index = 1;index <= 3;index++)
{
Console.Write(index);
}
}
}
";
List<string> expected = new List<string>() { "1", "2", "3" };
List<string> actual;
actual = target.Run(code, "1");
Assert.AreEqual(true, expected.SerializeEqual(actual));
actual = target.Run(code, "2");
Assert.AreEqual(true, expected.SerializeEqual(actual));
}
[TestMethod()]
public void Run35Test()
{
CodeRun target = new CodeRun();
string code = @"
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
public class Program
{
public static string Name { get; set; }
public static void Main()
{
Name = ""3"";
Console.Write(Name);
}
}
";
List<string> actual;
actual = target.Run(code, "1", "System.Core.dll");
Assert.AreEqual("3", actual[0]);
}
}
}
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved