Esempio n. 1
0
      public void Model_Is_ImageView()
      {
         ImageController controller = new ImageController();

         ActionResult result = controller.Index(new Guid("57c95cb2-dea3-486b-a951-d650e346ab59"), Principals.Collector);
         ViewResult viewResult = result as ViewResult;
         Assert.IsInstanceOfType(typeof(ImageView), viewResult.ViewData.Model);
      }
Esempio n. 2
0
      public void Should_Return_View_Result()
      {
         ImageController controller = new ImageController();

         ActionResult result = controller.Index(new Guid("57c95cb2-dea3-486b-a951-d650e346ab59"), Principals.Collector);

         Assert.IsInstanceOfType(typeof(ViewResult), result);
      }
Esempio n. 3
0
      public void Is_Publid_Is_True_For_Public_Image()
      {
         ImageController controller = new ImageController();

         ActionResult result = controller.Index(new Guid("57c95cb2-dea3-486b-a951-d650e346ab59"), Principals.Collector);
         ViewResult viewResult = result as ViewResult;
         ImageView image = viewResult.ViewData.Model as ImageView;
         Assert.IsTrue(image.IsPublic);
      }
Esempio n. 4
0
      public void Result_Has_No_Name_And_Contains_A_Model()
      {
         ImageController controller = new ImageController();

         ActionResult result = controller.Index(new Guid("57c95cb2-dea3-486b-a951-d650e346ab59"), Principals.Collector);
         ViewResult viewResult = result as ViewResult;

         Assert.IsEmpty(viewResult.ViewName);
         Assert.IsNotNull(viewResult.ViewData.Model);
      }
Esempio n. 5
0
      private static void AssertArgumentException(Guid id, string title, IPrincipal principal)
      {
         ImageController imageController = new ImageController();

         try
         {
            ActionResult result = imageController.UpdateTitle(id, title);
            Assert.Fail("Execption expected.");
         }
         catch (ArgumentException)
         {
            // this is expected
         }
      }
Esempio n. 6
0
      private static void AssertThrowsException(Guid id, Type type, IPrincipal principal)
      {
         ImageController imageController = new ImageController(new TestImageRepository(), new TestBinaryRepository());

         try
         {
            ActionResult result = imageController.MakePublic(id);
            Assert.Fail("Execption expected.");
         }
         catch (Exception e)
         {
            Assert.AreEqual(type, e.GetType());
            // this is expected
         }
      }
Esempio n. 7
0
 public void CreateController()
 {
    _imageController = new ImageController(new TestImageRepository(), new TestBinaryRepository());
 }