예제 #1
0
 private void writeTimer_Elapsed(object sender, ElapsedEventArgs e)
 {
     try
     {
         ApplicationInfoCollection result = this.GetCurrentStorageInfo();
         result.MergeWith(this.CurrentState);
         this.WriteStorageInfo(result);
     }
     catch (Exception exc)
     {
         Console.WriteLine(exc.Message);
     }
 }
예제 #2
0
        public void MergingTest()
        {
            ApplicationInfo info1 = new ApplicationInfo {
                Name = "proc1"
            };
            ApplicationInfo info2 = new ApplicationInfo {
                Name = "proc2"
            };

            ApplicationInfoCollection a = new ApplicationInfoCollection
            {
                info1
            };
            ApplicationInfoCollection b = new ApplicationInfoCollection
            {
                info2
            };

            a.MergeWith(b);

            Assert.AreEqual(a.Count, 2);
            Assert.AreEqual(a.First().Name, info1.Name);
            Assert.AreEqual(a.Skip(1).Take(1).First().Name, info2.Name);
        }