Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Side by Side Diff: visual_studio/NativeClientVSAddIn/UnitTests/MockProcessSearcher.cs

Issue 10758009: Native Client Visual Studio Add-in (Closed) Base URL: https://nativeclient-sdk.googlecode.com/svn/trunk/src
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5
6 namespace UnitTests
7 {
8 class MockProcessSearcher : NativeClientVSAddIn.IProcessSearcher
9 {
10 public MockProcessSearcher()
11 {
12 _results = new List<NativeClientVSAddIn.ProcessInfo>();
13 }
14
15 public List<NativeClientVSAddIn.ProcessInfo> GetResults(string constrain ts)
16 {
17 return _results;
18 }
19
20 public List<NativeClientVSAddIn.ProcessInfo> GetResultsByName(string Nam e)
21 {
22 List<NativeClientVSAddIn.ProcessInfo> ret = new List<NativeClientVSA ddIn.ProcessInfo>();
23 foreach (NativeClientVSAddIn.ProcessInfo proc in _results)
24 {
25 if (String.Compare(Name, proc.Name, true) == 0)
26 ret.Add(proc);
27 }
28
29 return ret;
Petr Hosek 2012/07/10 05:37:21 You can do this using a single expression with LIN
tysand 2012/07/11 05:23:46 Done.
30 }
31
32 public List<NativeClientVSAddIn.ProcessInfo> GetResultsById(uint procId)
33 {
34 List<NativeClientVSAddIn.ProcessInfo> ret = new List<NativeClientVSA ddIn.ProcessInfo>();
35 foreach (NativeClientVSAddIn.ProcessInfo proc in _results)
36 {
37 if (procId == proc.ID)
38 ret.Add(proc);
39 }
40
41 return ret;
Petr Hosek 2012/07/10 05:37:21 Same here `return _results.Select(p => procId == p
tysand 2012/07/11 05:23:46 Done.
42 }
43
44 private List<NativeClientVSAddIn.ProcessInfo> _results;
45
46 public List<NativeClientVSAddIn.ProcessInfo> Results
47 {
48 get { return _results; }
49 set { _results = value; }
50 }
51 }
52 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698