예제 #1
0
        public void allDevicesShouldHaveDiskSize()
        {
            tokenSource = new CancellationTokenSource();

            Assert.DoesNotThrow(() =>
            {
                var tsk = engine.BuildDevicesAsync(tokenSource.Token);
                tsk.Wait();
                devColl = tsk.Result;
            });

            devColl.AsParallel().ForAll(dev => {
                System.Diagnostics.Trace.WriteLine("Device " + dev.FriendlyName + " size is: " + (dev.DiskSize.HasValue == true ? dev.DiskSize.Value.ToString() : "<empty>"));
            });

            var zz = devColl.Where(dev => !(dev.DiskSize.HasValue && dev.DiskSize.Value >= 0));

            Assert.True(zz.Any() == false);
        }