Example #1
0
        public bool Assert <T>(T left, T right)
        {
            var equal = left.Equals(right);

            if (!equal)
            {
                _messageSink.LogError($"Expected {left}, but was {right}");
            }
            else
            {
                _messageSink.LogInfo($"Values were both {left}");
            }

            return(equal);
        }
Example #2
0
        public static IEnumerable <MethodInfo> EnumerateTestMethods(this string source, IEnumerable <ITestFeature> features, ITestMessageSink messageSink)
        {
            var methods = new HashSet <MethodInfo>();

            if (ShouldIgnoreAssembly(source))
            {
                return(methods);
            }

            try
            {
                var assembly = Assembly.LoadFile(source);

                if (assembly == typeof(TestKitchenTestDiscoverer).Assembly)
                {
                    return(methods);
                }

                if (assembly.IsDynamic)
                {
                    return(methods);
                }

                messageSink.LogInfo($"Probing source: {source}");

                foreach (var feature in features)
                {
                    foreach (var method in feature.EnumerateTestMethods(assembly, messageSink))
                    {
                        methods.Add(method);
                    }
                }
            }
            catch (Exception e)
            {
                messageSink.LogError(e.ToString());
                throw;
            }

            return(methods);
        }