forked from ServiceStack/ServiceStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMockClass.cs
More file actions
54 lines (49 loc) · 1.29 KB
/
MockClass.cs
File metadata and controls
54 lines (49 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;
using System.IO;
using NUnit.Framework;
using ServiceStack;
using ServiceStack.Html;
namespace CSharpEval
{
[TestFixture]
public class _Expr
: ServiceStack.ServiceHost.Tests.Formats.TemplateTests.CustomMarkdownViewBase
{
public MvcHtmlString EvalExpr_0()
{
return null;
}
//[Test]
public void Compare_access()
{
var filePath = "~/AppData/TestsResults/Customer.htm".MapProjectPath();
const int Times = 10000;
var start = DateTime.Now;
var count = 0;
for (var i=0; i< Times; i++)
{
var result = File.ReadAllText(filePath);
if (result != null) count++;
}
var timeTaken = DateTime.Now - start;
Console.WriteLine("File.ReadAllText: Times {0}: {1}ms", Times, timeTaken.TotalMilliseconds);
start = DateTime.Now;
count = 0;
//var fi = new FileInfo(filePath);
for (var i=0; i < Times; i++)
{
var result = File.GetLastWriteTime(filePath);
if (result != default(DateTime)) count++;
}
timeTaken = DateTime.Now - start;
Console.WriteLine("FileInfo.LastWriteTime: Times {0}: {1}ms", Times, timeTaken.TotalMilliseconds);
}
[Test]
public void A()
{
var str = "https://github.com/ServiceStack/ServiceStack.Redis/wiki/RedisPubSub";
var pos = str.IndexOf("/wiki");
Console.WriteLine(str.Substring(pos));
}
}
}