Exemple #1
0
        public void InvalidObjectReturnsInvalid()
        {
            // Arrange
            var cursusFile = new CursusFile();

            // Act
            var result = cursusFile.IsValid(new DateTime());

            // Assert
            Assert.AreEqual(false, result);
        }
Exemple #2
0
        public void NoFileReturnsInvalid()
        {
            // Arrange
            var cursusFile = new CursusFile();

            // Act
            var result = cursusFile.IsValid(null);

            // Assert
            Assert.AreEqual(false, result);
        }
Exemple #3
0
        public void InvalidFileReturnsInvalid()
        {
            // Arrange
            var cursusFile = new CursusFile();
            var formFile   = new FormFile(null, 0, 0, "Excelfile", "Excelfile.xlsx");

            // Act
            var result = cursusFile.IsValid(formFile);

            // Assert
            Assert.AreEqual(false, result);
        }
Exemple #4
0
        public void InvalidButEmptyFileReturnsInvalid()
        {
            // Arrange
            var cursusFile = new CursusFile();

            byte[] fileContents = Encoding.UTF8.GetBytes("TestFile");
            var    formFile     = new FormFile(new MemoryStream(fileContents), 0, 0, "TextFile", "TextFile.txt");

            // Act
            var result = cursusFile.IsValid(formFile);

            // Assert
            Assert.AreEqual(false, result);
        }