Ejemplo n.º 1
0
        protected virtual void FindProfiles(double guidanceTime)
        {
            Console.WriteLine("Expected Time: {0:0.000} ms", guidanceTime);
            var startTime = DateTime.UtcNow;
            var checkSum  = 0;
            var count     = 0;

            foreach (var property in Constants.FIND_PROFILES_PROPERTIES.Select(i =>
                                                                               _dataSet.Properties[i]).Where(i => i != null))
            {
                var values = property.Values.Select(i => i.Name).ToArray();
                _dataSet.ResetCache();
                foreach (var valueName in values)
                {
                    var profiles = _dataSet.FindProfiles(property.Name, valueName);
                    count++;
                    foreach (var profile in profiles)
                    {
                        checkSum += profile.Index;
                    }
                }
            }
            var averageTime = (double)(DateTime.UtcNow - startTime).TotalMilliseconds / (double)count;

            Console.WriteLine("Checksum: {0}", checkSum);
            Console.WriteLine("Average time: {0:0.000} ms", averageTime);
            if (averageTime > guidanceTime)
            {
                Assert.IsTrue(averageTime < guidanceTime,
                              String.Format("Average time of '{0:0.000}' ms exceeded guidance time of '{1:0.000}' ms",
                                            averageTime,
                                            guidanceTime));
            }
        }
Ejemplo n.º 2
0
        protected virtual void FindProfiles(double guidanceTime)
        {
            Console.WriteLine("Expected Time: {0:0.000} ms", guidanceTime);
            var startTime = DateTime.UtcNow;
            var checkSum  = 0;
            var count     = 0;

            foreach (var property in Constants.FIND_PROFILES_PROPERTIES.Select(i =>
                                                                               _dataSet.Properties[i]).Where(i => i != null))
            {
                var values = property.Values.Select(i => i.Name).ToArray();
                _dataSet.ResetCache();
                foreach (var valueName in values)
                {
                    var profiles = _dataSet.FindProfiles(property.Name, valueName);
                    count++;
                    foreach (var profile in profiles)
                    {
                        checkSum += profile.Index;
                    }
                }
                if (_dataSet.Values is ICacheList)
                {
                    Assert.IsTrue(((ICacheList)_dataSet.Values).CacheMisses == values.Length,
                                  String.Format(
                                      "Find profile expands the value cache and as such the misses should equal " +
                                      "the number of values. {0} misses occurred for {1} values.",
                                      ((ICacheList)_dataSet.Values).CacheMisses,
                                      values.Length));
                }
            }
            var averageTime = (double)(DateTime.UtcNow - startTime).TotalMilliseconds / (double)count;

            Console.WriteLine("Checksum: {0}", checkSum);
            Console.WriteLine("Average time: {0:0.000} ms", averageTime);
            if (averageTime > guidanceTime)
            {
                Assert.IsTrue(averageTime < guidanceTime,
                              String.Format("Average time of '{0:0.000}' ms exceeded guidance time of '{1:0.000}' ms",
                                            averageTime,
                                            guidanceTime));
            }
        }