Esempio n. 1
0
            public void Should_return_empty_given_MappedPropertyInfo_Type_is__Id()
            {
                MappedPropertyInfo mappedPropertyInfo = new MappedPropertyInfo(new HbmId(), null);

                _unique.Add(mappedPropertyInfo);
                string result = _builder.ToString();

                result.ShouldBeEqualTo("");
            }
        public TimeSpan?TryRead(object unique = null)
        {
            using (EntryBlockUC entry = Lock.TryEnter())
            {
                if (entry.EntryTypeUC == EntryTypeUC.None)
                {
                    return(null);
                }
                if (StopWatch == null)
                {
                    return(null);                                  //disposed
                }
                if (!StopWatch.IsRunning)
                {
                    return(null);
                }
                Unique.Add(unique);
                if (Unique.Count < MinUniques)
                {
                    return(null);
                }

                TimeSpan now = StopWatch.Elapsed;
                if (Next > now)
                {
                    return(Next - now);                           //not yet
                }
                Next += Period;
                if (ReadCounter++ > 0 || MinUniques == null)
                {
                    Queue.Enqueue(PerfCounter.Performance);
                }
                else
                {
                    // ReSharper disable once UnusedVariable
                    var aa = PerfCounter.Performance;
                }
                return(Next - now);
            }
        }
Esempio n. 3
0
    static bool OnSmallCaveTwice(Cave cave, IEnumerable <Cave> path)
    {
        if (!cave.IsSmall)
        {
            return(false);
        }
        Unique.Clear();
        var caveTwice        = false;
        var containsAddition = false;

        foreach (var prev in path.Skip(1).Where(t => t.IsSmall))
        {
            if (prev == cave)
            {
                if (caveTwice || containsAddition)
                {
                    return(true);
                }
                else
                {
                    containsAddition = true;
                }
            }
            else if (!Unique.Add(prev))
            {
                if (caveTwice || containsAddition)
                {
                    return(true);
                }
                else
                {
                    caveTwice = true;
                }
            }
        }
        return(false);
    }