Exemplo n.º 1
0
        public void CanReadNamedEntity()
        {
            var namedEntity = Fake.Create <NamedEntity>();

            new ReaderTest(
                setup: (writer) =>
            {
                new NamedEntityWriter(writer).Write(namedEntity);
            },
                test: (reader) =>
            {
                var record = new NamedEntityReader(reader).Read();
                Assert.Equal(namedEntity, record);
            }).Run();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Load named entities from output files
        /// </summary>
        private static void LoadNamedEntitiesFromFiles()
        {
            if (NamedEntityReader.FilesExist(PersonsFileName, OrganizationsFileName, LocationsFileName))
            {
                Persons       = NamedEntityReader.ReadData(PersonsFileName);
                Organizations = NamedEntityReader.ReadData(OrganizationsFileName);
                Locations     = NamedEntityReader.ReadData(LocationsFileName);

                var finder = new Finder(Persons, Organizations, Locations);
                finder.Find();
            }
            else
            {
                Console.WriteLine("Files not exists. Load from XML? (Y/N): ");
                if (Console.ReadLine().ToLower().Equals("y"))
                {
                    LoadNamedEntitiesFromXML();
                }
            }
        }