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

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: Style Fixed 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 using System;
6 using System.Collections.Generic;
7 using System.Linq;
8 using System.Text;
9
10 namespace UnitTests
11 {
12 /// <summary>
13 /// A fake process searcher that allows the list of 'processes' to be faked
14 /// </summary>
15 public class MockProcessSearcher : NativeClientVSAddIn.IProcessSearcher
16 {
17 /// <summary>
18 /// Constructs the fake process searcher
19 /// </summary>
20 public MockProcessSearcher()
21 {
22 Results = new List<NativeClientVSAddIn.ProcessInfo>();
23 }
24
25 /// <summary>
26 /// This fake version does not use the constraints, but returns it's fake li st of
27 /// known processes
28 /// </summary>
29 /// <param name="constraints">Unused</param>
30 /// <returns>Fake list of processes set in Results property</returns>
31 public List<NativeClientVSAddIn.ProcessInfo> GetResults(String constraints)
32 {
33 return Results;
34 }
35
36 /// <summary>
37 /// Searches the fake list of processes for all processes of a given name
38 /// </summary>
39 /// <param name="name">Name to search for</param>
40 /// <returns>List of matching processes</returns>
41 public List<NativeClientVSAddIn.ProcessInfo> GetResultsByName(String name)
42 {
43 return Results.FindAll(proc => name.Equals(proc.Name, StringComparison.Ord inalIgnoreCase));
44 }
45
46 /// <summary>
47 /// Searches the fake list of processes for all processes of a given ID
48 /// </summary>
49 /// <param name="procID">Process ID to search for</param>
50 /// <returns>List of matching processes</returns>
51 public List<NativeClientVSAddIn.ProcessInfo> GetResultsByID(uint procID)
52 {
53 return Results.FindAll(proc => procID == proc.ID);
54 }
55
56 /// <summary>
57 /// Fake list of processes this MockProcessSearcher knows about
58 /// </summary>
59 public List<NativeClientVSAddIn.ProcessInfo> Results { get; set; }
elijahtaylor1 2012/07/11 20:56:18 property naming
tysand 2012/07/12 23:56:15 Done.
60 }
61 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698