public FakeSearcherUnityContainer(List <Data> data, string source) { var mockBuffer = new Mock <IBuffer>(); var s = mockBuffer.SetupSequence(x => x.Dequeue()); foreach (var item in data) { s = s.Returns(item); } Buffer = mockBuffer.Object; var mochMethod = new Mock <ISearcherMethod>(); List <SearchResult> result = new List <SearchResult>(); result.Add(new SearchResult { Position = 4 }); List <SearchResult> notfoundResults = new List <SearchResult>(); //mochMethod.Setup(x => x.Search(It.IsAny<Data>(), It.IsAny<string>())).Returns(result); mochMethod.Setup(x => x.Search(data[0], source)).Returns(notfoundResults); mochMethod.Setup(x => x.Search(data[1], source)).Returns(notfoundResults); mochMethod.Setup(x => x.Search(data[2], source)).Returns(notfoundResults); mochMethod.Setup(x => x.Search(data[3], source)).Returns(result); mochMethod.Setup(x => x.Search(data[4], source)).Returns(notfoundResults); mochMethod.Setup(x => x.Search(data[5], source)).Returns(notfoundResults); mochMethod.Setup(x => x.Search(data[6], source)).Returns(notfoundResults); mochMethod.Setup(x => x.Search(data[7], source)).Returns(notfoundResults); _searcherNeMethod = mochMethod.Object; //_searcherNeMethod = new SearcherMethodRabina(); }
public FakeSearcherMultithreading(List <Data> datas) { var endData = new List <Data>(); var mockBuffer = new Mock <IBuffer>(); _buffer = mockBuffer.Object; var resultDeque = mockBuffer.SetupSequence(x => x.Dequeue()); // Буффер при каждом вызове метода buffer.SetupSequence разное значение foreach (var data in datas) { resultDeque = resultDeque.Returns(data); } _searcher = new SearcherMethodRabina(); var mockReader = new Mock <IReaderMulti>(); _reader = mockReader.Object; _SearcherMethodDecorator = new SearcherMethodDecorator(this, 4); }
public SearcherMethodTests(ISearcherMethod searcher) { _searcher = searcher; }
public SearcherSimple(IFileManager fManager, ISearcherMethod searcherMethod, IUnityContainer unityContainer) { _fileManager = fManager; _searcherMethod = searcherMethod; _unityContainer = unityContainer; }