public void Recorded_Method_Model_Test_Recording_Method_Init()
        {
            var guid       = Guid.NewGuid();
            var targetType = TestClass.Method1Entry.TargetType;
            var methodName = TestClass.Method1Entry.Method.Name;
            var serTarget  = "blah";
            var arg        = new List <object>()
            {
                2.0,
                "blah"
            };
            var methodBase = TestClass.Method1Entry.Method;
            var returnVal  = "foo";
            var serValue   = new SerializedValue(targetType, serTarget);

            var recordingMethod = new RecordingMethod(guid, serValue, arg, methodBase);

            recordingMethod.CloseOutMethodWithReturnVal(returnVal);

            var SUT = new RecordedMethod(recordingMethod);

            for (int i = 0; i < SUT.Args.Count; i++)
            {
                Assert.IsTrue(SUT.Args[i].Equals(arg[i]));
            }
            Assert.IsTrue(SUT.Identifier.Equals(guid));
            Assert.IsTrue(SUT.InstanceAtExecutionTime.Value.Equals(serTarget));
            Assert.IsTrue(SUT.MethodException == null);
            Assert.IsTrue(SUT.MethodData.MethodName == methodName);
            Assert.IsTrue(SUT.ReturnVal.GetType().Equals(returnVal.GetType()));
            Assert.IsTrue(SUT.ReturnVal.Equals(returnVal));
            Assert.IsTrue(SUT.SubMethods != null);
            Assert.IsTrue(SUT.TargetType.Equals(targetType));
        }
Example #2
0
        public void Execution_Recorder_Finished_Method_Should_Be_Added_To_DAL()
        {
            var _helper  = new Mock <IRecordedMethodHelper>();
            var _manager = new Mock <IRecordingMethodManager>();

            var entry  = TestClass.Method1Entry;
            var serVal = new SerializedValue(entry.TargetType, "");

            var recMethod = new RecordingMethod(Guid.NewGuid(), serVal, entry.MethodArgs, entry.Method);

            recMethod.CloseOutMethodWithReturnVal(TestClass.Method1Exit.ReturnValue);

            _manager.Setup(x => x.ProcessCapture(It.IsAny <InterceptionProcessingData>())).Raises(f => f.MethodRecordingComplete += null, new MethodRecordingCompleteEventArgs(recMethod));

            var SUT = new ExecutionRecorderProcess(_manager.Object, _helper.Object);

            SUT.ExecuteProcess(TestClass.Method1Entry);

            _helper.Verify(x => x.AddRecordedMethod(It.IsAny <RecordedMethod>()), Times.Once);
        }