AddFile() публичный Метод

Adds the given filename to the collection of files that should be considered to exist and set its contents so it can be read.
public AddFile ( string filename, string contents, Encoding encoding ) : void
filename string The filename (may or may not include path).
contents string The contents of the file
encoding System.Text.Encoding File encoding
Результат void
Пример #1
0
		/// -------------------------------------------------------------------------------------
		/// <summary>
		/// Create a CmPicture from a dummy file.
		/// </summary>
		/// -------------------------------------------------------------------------------------
		protected override void CreateTestData()
		{
			base.CreateTestData();

			m_fileOs = new MockFileOS();
			FileUtils.Manager.SetFileAdapter(m_fileOs);

			m_fileOs.AddFile(m_internalPath, "123", Encoding.Default);

			m_pictureFactory = Cache.ServiceLocator.GetInstance<ICmPictureFactory>();
			m_pict = m_pictureFactory.Create(m_internalPath,
				Cache.TsStrFactory.MakeString("Test picture", Cache.DefaultVernWs),
				CmFolderTags.LocalPictures);

			Assert.IsNotNull(m_pict);
			Assert.AreEqual("Test picture", m_pict.Caption.VernacularDefaultWritingSystem.Text);
			Assert.AreEqual(m_internalPath, m_pict.PictureFileRA.InternalPath, "Internal path not set correctly");
			Assert.AreEqual(m_internalPath, m_pict.PictureFileRA.AbsoluteInternalPath, "Files outside LangProject.LinkedFilesRootDir are stored as absolute paths");
		}