Ejemplo n.º 1
0
        private TextFileContentEntityOperationEvaluator CreateMockForSimpleFileContent(
            IEnumerable <string> fileNames, IEnumerable <string> paths)
        {
            MockRepository mocks = new MockRepository();
            var            fakeFileContentProvider = mocks.DynamicMock <IFileProvider>();
            var            fakePathOperator        = mocks.DynamicMock <PathOperatorEvaluator>();

            Expect.Call(fakeFileContentProvider.GetFileLinesContentFromHost("")).IgnoreArguments().Repeat.Any()
            .Return(this.CreateFakeFileLines());
            Expect.Call(fakePathOperator.ProcessOperationFileName(null, null, true)).IgnoreArguments()
            .Return(fileNames);
            Expect.Call(fakePathOperator.ProcessOperationsPaths(null)).IgnoreArguments()
            .Return(paths);

            mocks.ReplayAll();

            var objectCollector = new TextFileContentObjectCollector()
            {
                TargetInfo          = ProbeHelper.CreateFakeTarget(),
                FileContentProvider = fakeFileContentProvider
            };

            var operationEvaluator = new TextFileContentEntityOperationEvaluator(objectCollector, null, FamilyEnumeration.windows);

            operationEvaluator.PathOperatorEvaluator = fakePathOperator;

            return(operationEvaluator);
        }
Ejemplo n.º 2
0
        protected override void ConfigureObjectCollector()
        {
            if (base.ObjectCollector == null)
            {
                var connectionScope    = ((FileConnectionProvider)FileConnectionProvider).ConnectionScope;
                var newWmiDataProvider = new WmiDataProvider(connectionScope);
                var newFileProvider    = new WindowsFileProvider(TargetInfo)
                {
                    WmiDataProvider = newWmiDataProvider
                };

                ObjectCollector = new TextFileContentObjectCollector()
                {
                    FileContentProvider = newFileProvider, TargetInfo = TargetInfo
                };
                FileDataSource = new FileObjectCollector()
                {
                    WmiDataProvider = newWmiDataProvider
                };
            }

            if (base.ItemTypeGenerator == null)
            {
                var newFileProvider =
                    new WindowsFileProvider(this.TargetInfo)
                {
                    WmiDataProvider =
                        WmiDataProviderFactory
                        .CreateWmiDataProviderForFileSearching(this.TargetInfo)
                };

                var newOperationEvaluator =
                    new TextFileContentEntityOperationEvaluator(ObjectCollector, newFileProvider, FamilyEnumeration.windows);

                ItemTypeGenerator = new TextFileContentItemTypeGenerator()
                {
                    OperationEvaluator = newOperationEvaluator
                };
            }
        }