예제 #1
0
        public async Task AddChapter_ChapterIsNotUploaded_WhenImageIsNotCorrect()
        {
            using (var db = new ArtDbContext(TestingDbContextOptions.TestDbContextOptions()))
            {
                var physicalFile = new FileInfo("links.txt");
                var formFile     = physicalFile.AsMockIFormFile();

                var controller = new ComicController(db);

                await controller.AddChapter(formFile, "Test", 1);

                Assert.AreEqual(controller.ModelState.ErrorCount, 1);
            }
        }
예제 #2
0
        public async Task UploadComic_ComicIsUploaded_WhenImageIsCorrectPng()
        {
            using (var db = new ArtDbContext(TestingDbContextOptions.TestDbContextOptions()))
            {
                var physicalFile = new FileInfo("002.png");
                var formFile     = physicalFile.AsMockIFormFile();

                var controller = new ComicController(db);
                try
                {
                    await controller.UploadComic(formFile, "Test", "Test", "Test");
                }
                catch { }

                Assert.AreEqual(controller.ModelState.ErrorCount, 0);
            }
        }