示例#1
0
        public static void MetaDataService_DefaultProfilesIds(IWrapper wrapper)
        {
            var service = new MetaDataService(
                wrapper.Pipeline.FlowElements
                .Where(e => typeof(IOnPremiseDeviceDetectionEngine).IsAssignableFrom(e.GetType()))
                .Cast <IOnPremiseDeviceDetectionEngine>()
                .ToArray());
            var defaultProfiles = service.DefaultProfilesIds();

            // Expect 5 components:
            // hardware, platform, browser, crawler and metrics.
            // metrics does not actually exist in the data file and
            // does not have a default profile so it will be null.
            Assert.AreEqual(5, defaultProfiles.Count);
            Assert.IsTrue(defaultProfiles.ContainsKey(1));
            Assert.IsTrue(defaultProfiles.ContainsKey(2));
            Assert.IsTrue(defaultProfiles.ContainsKey(3));
            Assert.IsTrue(defaultProfiles.ContainsKey(4));
            Assert.IsTrue(defaultProfiles.ContainsKey(255));
            Assert.AreEqual((uint)15364, defaultProfiles[1]);
            Assert.AreEqual((uint)17017, defaultProfiles[2]);
            Assert.AreEqual((uint)17470, defaultProfiles[3]);
            Assert.AreEqual((uint)18092, defaultProfiles[4]);
            Assert.IsNull(defaultProfiles[255]);
        }