예제 #1
0
        private void CreateAll(CpuIdXmlFactory factory, string fileName)
        {
            Console.WriteLine("Instantiating: {0}", fileName);
            IEnumerable <ICpuId> cpus = factory.CreateAll(fileName);

            foreach (ICpuId cpu in cpus)
            {
                Assert.That(cpu, Is.Not.Null);

                CpuId.Intel.ICpuIdX86 x86cpu = cpu as CpuId.Intel.ICpuIdX86;

                switch (cpu.CpuVendor)
                {
                case CpuVendor.AuthenticAmd:
                    Assert.That(x86cpu, Is.Not.Null);
                    if (!string.IsNullOrEmpty(x86cpu.BrandString) && !x86cpu.BrandString.Equals(x86cpu.Description))
                    {
                        // Used for debugging if the conversion to the brand string is correct. We only check those that
                        // actually have a brand string.
                        Console.WriteLine("  CPU Brand: {0}; Description: {1}", x86cpu.BrandString, x86cpu.Description);
                    }
                    break;

                case CpuVendor.GenuineIntel:
                    Assert.That(x86cpu, Is.Not.Null);
                    break;
                }
            }
        }
예제 #2
0
        public void IntelCreateAllFromXmlConstructorFile()
        {
            CpuIdXmlFactory      factory = new CpuIdXmlFactory(MultiCpu);
            IEnumerable <ICpuId> cpus    = factory.CreateAll();

            Assert.That(cpus, Is.Not.Null);
            Assert.That(cpus.Count(), Is.EqualTo(8));
            foreach (ICpuId id in cpus)
            {
                Assert.That(id.Description, Is.EqualTo("Intel(R) Core(TM) i7-9700 CPU @ 3.00GHz"));
            }
        }