Esempio n. 1
0
        public void When_File_Does_Not_Exist_Then_ArgumentException_Is_Thrown()
        {
            // Setup
            var reader = new FileUserListReader();

            // Execute
            reader.GetUserNamesFromList("NoFile.config");
        }
Esempio n. 2
0
        public void When_Filename_Is_Empty_Then_UserList_Is_Empty()
        {
            // Setup
            var reader = new FileUserListReader();

            // Execute
            var result = reader.GetUserNamesFromList(string.Empty);

            // Verify
            Assert.AreEqual(0, result.Count());
        }
Esempio n. 3
0
        public void When_File_Is_Empty_Then_UserList_Is_Empty()
        {
            // Setup
            var fileName = CreateFileWithContent(string.Empty);
            var reader   = new FileUserListReader();

            // Execute
            var result = reader.GetUserNamesFromList(fileName);

            // Verify
            Assert.AreEqual(0, result.Count());

            // TearDown
            File.Delete(fileName);
        }
Esempio n. 4
0
        public void When_File_Contains_Empty_Lines_Then_UserList_Only_Contains_Actual_User_Names()
        {
            // Setup
            const string FILE_CONTENT = "User1\r\nUser2\n\n";
            var          fileName     = CreateFileWithContent(FILE_CONTENT);

            var reader = new FileUserListReader();

            // Execute
            var result = reader.GetUserNamesFromList(fileName);

            // Verify
            Assert.AreEqual(2, result.Count());
            CollectionAssert.Contains(result.ToArray(), "User1");
            CollectionAssert.Contains(result.ToArray(), "User2");

            // TearDown
            File.Delete(fileName);
        }