/// <summary>
        ///Peek 的测试
        ///</summary>
        public void PeekTestHelper <ValueT>()
        {
            SafeStack <ValueT> target   = new SafeStack <ValueT>(); // TODO: 初始化为适当的值
            ValueT             expected = default(ValueT);          // TODO: 初始化为适当的值
            ValueT             actual;

            actual = target.Peek();
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("验证此测试方法的正确性。");
        }
Exemple #2
0
        // Unable to cast from object to MachineId.
        public override void CallResultObject(object value)
        {
            try
            {
                if (value == null)
                {
                    return;
                }
                MachineId r = (MachineId)value;
                if (this.IsCreateMachineMethod && CallStack.Peek().FullName.Contains("InitializeStateInformation"))
                {
                    this.IsCreateMachineMethod = false;

                    ThreadTrace obj = this.ThreadTrace[this.ThreadTrace.Count - 1];
                    obj.Accesses.Add(new ActionInstr(r.GetHashCode(), true));
                }
            }
            catch (Exception)
            {
                try
                {
                    Task tid = (Task)value;
                    this.DebugTrace.Add($"<ThreadMonitorLog> Task {tid.Id} created.");
                    if (TaskMethods.Count > 0)
                    {
                        Method m = TaskMethods[TaskMethods.Count - 1].Item1;
                        TaskMethods[TaskMethods.Count - 1] = new Tuple <Method, int>(m, tid.Id);
                        ThreadTrace obj = this.ThreadTrace[this.ThreadTrace.Count - 1];
                        obj.Accesses.Add(new ActionInstr(true, tid.Id));
                    }
                }
                catch (Exception)
                {
                    // TODO: this is a hack.
                }
            }
        }