-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.txt
63 lines (53 loc) · 1.84 KB
/
template.txt
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
55
56
57
58
59
60
61
62
63
[TestClass]
public class TableControllerCreateActionTests
{
private TableController tableController;
[TestInitialize]
public void TestInitialize()
{
this.tableController = ControllerFactory.GetTableController();
}
[TestCleanup]
public void TestCleanup()
{
this.tableController.Dispose();
}
[TestMethod]
public void TableControllerCreateActionGetActionRendersRightView()
{
//arrange
string viewName = "Create";
//act
ViewResult result = tableController.Create() as ViewResult;
//assert
Assert.IsNotNull(result);
Assert.AreEqual(viewName, result.ViewName);
}
[TestMethod]
public void TableControllerCreateActionPostModelStateInvalid()
{
//arrange
string viewName = "Create";
tableController.ModelState.AddModelError("test", "test");
var table = Constants.tablesNotInDatabase[0];
//act
ViewResult result = tableController.Create(table) as ViewResult;
//assert
Assert.IsNotNull(result);
Assert.AreEqual(viewName, result.ViewName);
}
[TestMethod]
public void TableControllerCreateActionPostModelStateValid()
{
//arrange
string viewName = "AllTables";
var table = Constants.tablesNotInDatabase[0];
//act
ViewResult result = tableController.Create(table) as ViewResult;
var model = (result.ViewData.Model as IEnumerable<TableModel>).ToList();
//assert
Assert.IsNotNull(result);
Assert.AreEqual(viewName, result.ViewName);
CollectionAssert.Contains(model, table);
}
}