コード例 #1
0
        void VerifyMethodNameses(IEnumerable <InvocationInfo> methods, string prefix, string body, State state,
                                 InvocationInfo.Timing timing, HashSet <string> suffixes)
        {
            Assert.Equal(suffixes.Count, methods.Count());

            foreach (InvocationInfo method in methods)
            {
                Debug.WriteLine("Method description is \"" + method.Description + "\"");
                //
                bool matches = false;
                foreach (string suffix in suffixes)
                {
                    if (state == State.A)
                    {
                        matches = (method.Description == (prefix + body
                                                          + ((timing == InvocationInfo.Timing.Asynchronous) ? "Async" : "" + suffix)));
                    }
                    else if (state == State.B)
                    {
                        matches = (UserDescription + "B-" + body + suffix == method.Description);
                    }
                    else if (state == State.C)
                    {
                        matches = (InvocationInfo.DefaultFunctionDescription == method.Description);
                    }
                    else if (state == State.D)
                    {
                        matches = (UserDescription + "D-" + body + suffix == method.Description);
                    }
                    //
                    if (matches)
                    {
                        suffixes.Remove(suffix);
                        break;
                    }
                }
                if (!matches)
                {
                    Debug.WriteLine("No match for \"" + method.Description + "\"");
                }
                Assert.True(matches);
                //
                Assert.Equal(timing == InvocationInfo.Timing.Asynchronous, method.IsAsync);
            }
        }
コード例 #2
0
        void VerifyMethodNames(IEnumerable <InvocationInfo> methods, string prefix, string body, State state, InvocationInfo.Timing timing)
        {
            Assert.Equal(1, methods.Count());
            InvocationInfo method = methods.First();

            if (state == State.A)
            {
                Assert.Equal(prefix + body + ((timing == InvocationInfo.Timing.Asynchronous) ? "Async" : ""), method.Description);
            }
            else if (state == State.B)
            {
                Assert.Equal(UserDescription + "B-" + body, method.Description);
            }
            else if (state == State.C)
            {
                Assert.Equal(InvocationInfo.DefaultFunctionDescription, method.Description);
            }
            else if (state == State.D)
            {
                Assert.Equal(UserDescription + "D-" + body, method.Description);
            }

            Assert.Equal(timing == InvocationInfo.Timing.Asynchronous, method.IsAsync);
        }