Exemple #1
0
        public void SerializeEnter_Tests()
        {
            IMethodEventFormatter formatter = new MethodEventFormatter(new TestParameterFormatter());

            Assert.AreEqual("Enter Object.ToString()", formatter.SerializeEnter(typeof(object), ObjectToString, new object[0]));
            Assert.AreEqual("Enter TestSubject.ToString()", formatter.SerializeEnter(typeof(TestSubject), ObjectToString, new object[0]));

            Assert.AreEqual("Enter TestSubject.TestMethod1()", formatter.SerializeEnter(typeof(TestSubject), Method1, new object[0]));
            Assert.AreEqual("Enter TestSubject.TestMethod2(p1: X)", formatter.SerializeEnter(typeof(TestSubject), Method2, new object[1]));
            Assert.AreEqual("Enter TestSubject.TestMethod3(p1: X, p2: X)", formatter.SerializeEnter(typeof(TestSubject), Method3, new object[2]));
            Assert.AreEqual("Enter TestSubject.TestMethod4(p1: X, p2: X, p3: X)", formatter.SerializeEnter(typeof(TestSubject), Method4, new object[3]));
            Assert.AreEqual("Enter TestSubject.TestMethod5(p1: X, p2: X, p3: X)", formatter.SerializeEnter(typeof(TestSubject), Method5, new object[3]));
            Assert.AreEqual("Enter TestSubject.TestMethod6(p1: X, p2: X, ref p3: X)", formatter.SerializeEnter(typeof(TestSubject), Method6, new object[3]));
            Assert.AreEqual("Enter TestSubject.TestMethod7(p1: X, p2: X)", formatter.SerializeEnter(typeof(TestSubject), Method7, new object[3]));
        }
Exemple #2
0
        public void SerializeEnter_WithNullParameters_ThrowsArgumentNullException()
        {
            IMethodEventFormatter formatter = new MethodEventFormatter(Substitute.For <IParameterFormatter>());

            formatter.SerializeEnter(typeof(TestSubject), Method1, null);
        }
Exemple #3
0
        public void SerializeEnter_WithParameterCountMismatch_ThrowsArgumentException()
        {
            IMethodEventFormatter formatter = new MethodEventFormatter(Substitute.For <IParameterFormatter>());

            formatter.SerializeEnter(typeof(TestSubject), Method1, new object[100]);
        }
Exemple #4
0
        public void SerializeEnter_WithNullType_ThrowsArgumentNullException()
        {
            IMethodEventFormatter formatter = new MethodEventFormatter(Substitute.For <IParameterFormatter>());

            formatter.SerializeEnter(null, Method1, new object[0]);
        }