Esempio n. 1
0
        public void GetMultiCrossReferenceItem_ShouldReturnItemById()
        {
            var processName = "Process";
            var dynamicTypeManager = new DynamicTypeManager();

            var loggerMock = Mock.Create<ILogger>();
            dynamicTypeManager.Logger = loggerMock;

            var result = new CrossReferenceListBase();
            result.Add(Mock.Create<ICrossRefItemInfo>());

            var type = this.GetType();
            var asm = Assembly.GetCallingAssembly();

            Mock.NonPublic.Arrange<Assembly>(typeof(DynamicTypeManager), "loadAssembly", "Process").Returns(asm);
            Mock.Arrange(() => asm.GetType("DynamicProcess.ProcessFieldList")).Returns(type);
            Mock.Arrange(() => MethodCaller.CallFactoryMethod(type, "GetProcessFieldListById", 1, false)).Returns(result);

            var item = dynamicTypeManager.GetMultiCrossReferenceItem(processName, "Field", 1);

            Assert.AreSame(result[0], item);
        }