Пример #1
0
        public void Throws_If_Adding_Invalid_Dir_Name(string dirName)
        {
            var dirBuilder = new DirectoryBuilder(Path.GetTempPath());

            var exception = Assert.Throws <ArgumentException>(() =>
            {
                dirBuilder.AddSubdirectoryAndStay(dirName);
            });

            Assert.Equal("directoryName", exception.ParamName);
            Assert.Contains("Directory name can't contains invalid chars", exception.Message);

            exception = Assert.Throws <ArgumentException>(() =>
            {
                dirBuilder.AddSubdirectoryAndEnter(dirName);
            });

            Assert.Equal("directoryName", exception.ParamName);
            Assert.Contains("Directory name can't contains invalid chars", exception.Message);
        }