示例#1
0
 public void FakeVmExecuteTest()
 {
     var st = new FakeSkyTap();
     st.AddSet(TestVmRESTData.vms);
     var request = new RestRequest();
     var reply = st.Execute<Vm>(request);
     Assert.IsNotNull(reply);
     Assert.AreSame(typeof(Vm), reply.GetType());
 }
示例#2
0
 public void FakeVmExecuteListTest()
 {
     var st = new FakeSkyTap();
     st.AddSet(TestVmRESTData.vms);
     var request = new RestRequest();
     var reply = st.ExecuteList<Vm>(request);
     Assert.IsNotNull(reply);
     Assert.AreEqual(typeof(List<Vm>), reply.GetType());
     Assert.AreEqual(10, reply.Count);
     Assert.AreEqual(typeof(Vm), (reply[0]).GetType());
 }
 public void CourseEditNewStartTest()
 {
     var db = new FakeDatabase();
     var st = new FakeSkyTap();
     db.AddSet(TestCourseData.Courses);
     db.AddSet(TestCourseMachineTempData.CourseMachineTemps);
     st.AddSet(TestTemplateRESTData.templates);
     var controller = new CoursesController(db, st);
     controller.ControllerContext = new FakeControllerContext();
     ViewResult result = controller.Edit(0) as ViewResult;
     Assert.IsNotNull(result);
     Assert.AreEqual(11, ((List<Template>)((SelectList)result.ViewBag.Template).Items).Count);
     Assert.AreEqual(typeof(Course), result.Model.GetType());
     Assert.AreEqual("New", ((Course)result.Model).Name);
 }
 public void CourseEditNewWriteTest()
 {
     var db = new FakeDatabase();
     var st = new FakeSkyTap();
     db.AddSet(TestCourseData.Courses);
     db.AddSet(TestCourseMachineData.CourseMachines);
     db.AddSet(TestCourseMachineTempData.CourseMachineTemps);
     st.AddSet(TestTemplateRESTData.templates);
     var controller = new CoursesController(db, st);
     controller.ControllerContext = new FakeControllerContext();
     Course testCourse = new Course() { CourseId = 0, Name = "TestNew", Days = 5, Hours = 8, Template = "11111111" };
     var result = controller.Edit(testCourse, Guid.NewGuid().ToString());
     Assert.IsNotNull(result);
     Assert.AreEqual(typeof(RedirectToRouteResult), result.GetType());
     Assert.AreEqual(1, db.Added.Count);
     Assert.AreEqual("TestNew", ((Course)db.Added[0]).Name);
     Assert.AreEqual(3, db.saved);
 }