コード例 #1
0
        public void Initialize()
        {
            ServiceLocator.SetLocatorProvider(() => new NinjectServiceLocator(new StandardKernel()));

            var attachment = new Attachment
            {
                FileName = "network.jpg",
                FileDiskName = "network.jpg",
                FilePath = "images",
                FileType = "image/jpeg"
            };

            var service = MockRepository.GenerateMock<IAttachmentService>();

            service.Stub(x => x.GetById(1)).Return(attachment);

            service.Stub(x => x.GetById(2)).Return(new Attachment
            {
                FileName = "fake.jpg",
                FileDiskName = "fake.jpg",
                FilePath = "fake",
                FileType = "fake"
            });

            service.Stub(x => x.GetThumbnail(attachment, 100, 100)).Return(new FileInfo(attachment.FullPath.AsPath()));

            var controller = new AttachmentController(service);

            this.AttachmentController = controller;
        }
コード例 #2
0
ファイル: AttachmentTest.cs プロジェクト: Mike343/Netcoders
        public void Test_Attachment_FullPath()
        {
            var attachment = new Attachment
            {
                FilePath = "directory",
                FileDiskName = "test.zip"
            };

            Assert.AreEqual("directory/test.zip", attachment.FullPath);
        }
コード例 #3
0
ファイル: AttachmentDelete.cs プロジェクト: Mike343/Netcoders
        /// <summary>
        /// Initializes a new instance of the <see cref="AttachmentDelete"/> class.
        /// </summary>
        /// <param name="attachment">The attachment.</param>
        public AttachmentDelete(Attachment attachment)
        {
            if (attachment == null)
            {
                throw new ArgumentNullException("attachment");
            }

            this.Id = attachment.Id;
            this.Title = attachment.FileName;
            this.Soft = true;
        }
コード例 #4
0
        public void Test_AttachmentUpdate_ValueToModel()
        {
            var value = new AttachmentUpdate
            {
                FileName = "test"
            };

            var attachment = new Attachment();

            value.ValueToModel(attachment);

            Assert.AreEqual("test", value.FileName, "FileName");
        }
コード例 #5
0
        public void Test_AttachmentService_GetThumbnail()
        {
            var attachment = new Attachment
            {
                FileDiskName = "test.jpg",
                FilePath = "\\images",
                FileWidth = 200,
                FileHeight = 200
            };

            var result = this.AttachmentService.GetThumbnail(attachment, 100, 100);

            Assert.IsNotNull(result, "Result");
            Assert.AreEqual("C:\\images\\test_100_100.jpg", result.FullName, "FileName");
        }
コード例 #6
0
 public void Insert(Attachment entity)
 {
 }
コード例 #7
0
 public FileInfo GetThumbnail(Attachment attachment, int width, int height)
 {
     return null;
 }
コード例 #8
0
 public void Delete(Attachment attachment, bool soft)
 {
 }
コード例 #9
0
 public void Delete(Attachment entity)
 {
 }
コード例 #10
0
 public void Update(Attachment entity)
 {
 }