private ConsoleColor GetCallerColour()
        {
            var method = _writeCallerFinder.GetTheMethod() ?? _traceCallerFinder.GetTheMethod();
            var hash   = _md5.ComputeHash(Encoding.UTF8.GetBytes(method == null ? "XXXX" : method.Name));

            return(_colours[hash[hash.Length / 2] % _colours.Length]);
        }
Esempio n. 2
0
        public void ItWasMeCalledTraceWrite()
        {
            var whoCalledAMethod = new WhoCalledAMethod("BeeHive.Tests.WhoCalledTraceTests",
                                                        "ItWasMeCalledTraceWrite");

            var method = whoCalledAMethod.GetTheMethod();

            Assert.Equal(method.DeclaringType.ToString(), "System.RuntimeMethodHandle");
            Assert.Equal(method.Name, "InvokeMethod");
        }