コード例 #1
0
ファイル: File_Specs.cs プロジェクト: daffers/Magnum
        public void Setup()
        {
            _location = Assembly.GetExecutingAssembly().Location;
    		_directory = Path.GetDirectoryName(_location);
    		_directory = _directory.Substring(_directory.LastIndexOf('\\') + 1);

            _fileName = FileName.GetFileName(_location);
        }
コード例 #2
0
ファイル: DotNetFile.cs プロジェクト: daffers/Magnum
        public void CopyTo(FileName path)
        {
            //refactor?
            if (System.IO.File.Exists(path.GetPath()))
                System.IO.File.Delete(path.GetPath());

            WithStream(s=>
            {
                using(var stream = System.IO.File.OpenWrite(path.GetPath()))
                {
                    //.net 4.0 has a stream.CopyTo method
                    var buff = new byte[32768];
                    while (true)
                    {
                        int read = s.Read(buff, 0, buff.Length);

                        if (read <= 0)
                            return;

                        stream.Write(buff, 0, read);
                    }
                }
            });
        }
コード例 #3
0
 public void When_you_get_a_file_that_DOESNT_exist()
 {
     _fileName = FileName.GetFileName(".\\doesntexist.txt");
 }
コード例 #4
0
		public void When_you_get_a_file_that_exists()
		{
			_fileName = FileName.GetFileName(Assembly.GetExecutingAssembly().Location);

            _fileInQuestion = Locator.GetFile(_fileName);
		}
コード例 #5
0
		public File GetFile(FileName name)
		{
			File file = ResolveFile(name.Name);

			return file;
		}
コード例 #6
0
ファイル: DotNetFile.cs プロジェクト: daffers/Magnum
		public DotNetFile(FileName name)
		{
			Name = name;
		}