Пример #1
0
      public void Model_Is_ImageView()
      {
         ImageController controller = new ImageController(new SqlImageRepository(), new S3BinaryRepository());

         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);
      }
Пример #2
0
      public void Should_Return_View_Result()
      {
         ImageController controller = new ImageController(new SqlImageRepository(), new S3BinaryRepository());

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

         Assert.IsInstanceOfType(typeof(ViewResult), result);
      }
Пример #3
0
      public void Is_Publid_Is_True_For_Public_Image()
      {
         ImageController controller = new ImageController(new SqlImageRepository(), new S3BinaryRepository());

         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);
      }
Пример #4
0
      public void Result_Has_No_Name_And_Contains_A_Model()
      {
         ImageController controller = new ImageController(new SqlImageRepository(), new S3BinaryRepository());

         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);
      }
Пример #5
0
      private static void AssertArgumentException(Guid id, string title, IPrincipal principal)
      {
         ImageController imageController = new ImageController(new TestImageRepository(), new TestBinaryRepository());

         try
         {
            ActionResult result = imageController.UpdateTitle(id, title);
            Assert.Fail("Execption expected.");
         }
         catch (ArgumentException)
         {
            // this is expected
         }
      }
Пример #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
         }
      }
Пример #7
0
 public void CreateController()
 {
    _imageController = new ImageController(new TestImageRepository(), new TestBinaryRepository());
 }