public void Overwrite() { string path = directory + pathTest1; TextLoader textLoader = new TextLoader(path, Encoding.UTF8); try { textLoader.Download(path, false); throw new Exception("not passed"); } catch (Exception ex) { Assert.Equal("File couldn't be overwritten", ex.Message); } }