Пример #1
0
		private void Write(string file)
		{
			string dir = "/home/david/Projects/Gedcom.NET/Data/tests";
			string gedcomFile = Path.Combine(dir,file);
			
			string outputDir = Path.Combine(dir,"Output");
			string expectedDir = Path.Combine(dir,"Expected");
			
			GedcomRecordReader reader = new GedcomRecordReader();
			reader.ReadGedcom(gedcomFile);
			
			NUnit.Framework.Assert.Greater(reader.Database.Count,0,"No records read");
			
			_writer = new GedcomRecordWriter();
			_writer.Test = true;
			_writer.Database = reader.Database;
			_writer.GedcomFile = Path.Combine(outputDir,file);

			_writer.ApplicationName = "Gedcom.NET";
			_writer.ApplicationSystemID = "Gedcom.NET";
			_writer.ApplicationVersion = "Test Suite";
			_writer.Corporation = "David A Knight";
			
			_writer.WriteGedcom();
			
			string expectedOutput = Path.Combine(expectedDir,file);
			if (!File.Exists(expectedOutput))
			{
				File.Copy(_writer.GedcomFile,expectedOutput);	
			}
			
			string written = File.ReadAllText(_writer.GedcomFile);
			string expected = File.ReadAllText(expectedOutput);
								
			NUnit.Framework.Assert.IsTrue(written == expected, "Output differs from expected");
			
		}
Пример #2
0
	private void DoSaveGedcom(string gedcomFile)
	{
		if (_currentView != null)
		{
			_currentView.SaveView();	
		}
		
		GedcomRecordWriter writer = new GedcomRecordWriter();
		writer.Database = _database;
		writer.GedcomFile = gedcomFile;

		writer.ApplicationName = MainClass.AppDisplayName;
		writer.ApplicationSystemID = MainClass.AppDisplayName;
		writer.ApplicationVersion = MainClass.AppVersion;
		writer.Corporation = MainClass.AppAuthors[0];
		writer.CorporationAddress = MainClass.AppAddress;

		writer.AllowInformationSeparatorOneSave = AppSettings.Instance.AllowInformationSeparatorOneSave;
		writer.AllowLineTabsSave = AppSettings.Instance.AllowLineTabsSave;
		writer.AllowTabsSave = AppSettings.Instance.AllowTabsSave;
		
		writer.WriteGedcom();
		
		_gedcomFile = gedcomFile;
		
		_database.Name = _gedcomFile;
	}
Пример #3
0
		private void DoSaveGedcom(string gedcomFile)
		{
			if (_currentView != null)
			{
				_currentView.SaveView();
			}

			GedcomRecordWriter writer = new GedcomRecordWriter();
			writer.Database = _database;
			writer.GedcomFile = gedcomFile;
			writer.WriteGedcom();

			_gedcomFile = gedcomFile;

			_database.Name = _gedcomFile;
		}