Example #1
0
        public void MultpleRecordsWriteAsync()
        {
            engine = new MultiRecordEngine(new RecordTypeSelector(CustomSelector),
                                           typeof(OrdersVerticalBar),
                                           typeof(CustomersSemiColon),
                                           typeof(SampleType));

            object[] records = engine.ReadFile(FileTest.Good.MultiRecord1.Path);

            engine.BeginWriteFile("tempoMulti.txt");
            foreach (var o in records)
            {
                engine.WriteNext(o);
            }
            engine.Close();
            File.Delete("tempoMulti.txt");


            object[] res = engine.ReadFile(FileTest.Good.MultiRecord1.Path);

            Assert.AreEqual(12, res.Length);
            Assert.AreEqual(12, engine.TotalRecords);

            Assert.AreEqual(typeof(OrdersVerticalBar), res[0].GetType());
            Assert.AreEqual(typeof(OrdersVerticalBar), res[1].GetType());
            Assert.AreEqual(typeof(CustomersSemiColon), res[2].GetType());
            Assert.AreEqual(typeof(SampleType), res[5].GetType());
        }
Example #2
0
		public void MultpleRecordsWriteAsync()
		{
			engine = new MultiRecordEngine(new RecordTypeSelector(CustomSelector), typeof(OrdersVerticalBar), typeof(CustomersSemiColon), typeof(SampleType));

			object[] records = engine.ReadFile(Common.TestPath(@"Good\MultiRecord1.txt"));

			engine.BeginWriteFile("tempoMulti.txt");
			foreach (object o in records)
			{
				engine.WriteNext(o);
			}
			engine.Close();
			File.Delete("tempoMulti.txt");


			object[] res = engine.ReadFile(Common.TestPath(@"Good\MultiRecord1.txt"));

			Assert.AreEqual(12, res.Length);
			Assert.AreEqual(12, engine.TotalRecords);

			Assert.AreEqual(typeof(OrdersVerticalBar), res[0].GetType());
			Assert.AreEqual(typeof(OrdersVerticalBar), res[1].GetType());
			Assert.AreEqual(typeof(CustomersSemiColon), res[2].GetType());
			Assert.AreEqual(typeof(SampleType), res[5].GetType());
		}
Example #3
0
        public void GivenStreaming_EventIsRaised()
        {
            var lobamba = new NotifyCity {
                Name = "Lobamba", Population = 11000
            };
            var rhine = new River {
                Name = "Rhine", LengthKilometers = 1230
            };
            var geography = new object[] { lobamba, rhine };

            var cityRiverEngine = new MultiRecordEngine(typeof(NotifyCity), typeof(River));

            cityRiverEngine.BeginWriteFile("geography.txt");
            cityRiverEngine.WriteNexts(geography);

            Assert.AreEqual(2, mCityEventCount);
        }