-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathStoredProcTest.cs
47 lines (40 loc) · 1.68 KB
/
StoredProcTest.cs
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
using System;
using NUnit.Framework;
namespace Agoda.Frameworks.DB.Tests
{
public class StoredProcTest
{
public class TestRequestParameter
{
public DateTime DateTimeParam { get; set; }
public int IntParam { get; set; }
public string StringParam { get; set; }
}
public class TestStoredProc : AutoStoredProc<TestRequestParameter, object>
{
public override TimeSpan? CacheLifetime => throw new NotImplementedException();
public override string DbName => throw new NotImplementedException();
public override string StoredProcedureName => throw new NotImplementedException();
public override int CommandTimeoutSecs => throw new NotImplementedException();
public override int MaxAttemptCount => throw new NotImplementedException();
}
[Test]
public void AutoStoredProc_GetParameters()
{
var sp = new TestStoredProc();
var parameters = sp.GetParameters(new TestRequestParameter()
{
IntParam = 87,
StringParam = "EightSeven",
DateTimeParam = new DateTime(2020, 8, 7)
});
Assert.AreEqual(3, parameters.Length);
Assert.AreEqual("DateTimeParam", parameters[0].Name);
Assert.AreEqual(new DateTime(2020, 8, 7), (DateTime)parameters[0].Value);
Assert.AreEqual("IntParam", parameters[1].Name);
Assert.AreEqual(87, (int)parameters[1].Value);
Assert.AreEqual("StringParam", parameters[2].Name);
Assert.AreEqual("EightSeven", (string)parameters[2].Value);
}
}
}