1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
5
using ICSharpCode.PackageManagement;
6
using ICSharpCode.PackageManagement.Design;
7
using ICSharpCode.PackageManagement.Scripting;
9
using PackageManagement.Tests.Helpers;
11
namespace PackageManagement.Tests
14
public class PackageActionsToRunTests
16
PackageActionsToRun actions;
20
actions = new PackageActionsToRun();
23
InstallPackageAction AddAction()
25
var project = new FakePackageManagementProject();
26
var events = new FakePackageManagementEvents();
27
var action = new InstallPackageAction(project, events);
28
actions.AddAction(action);
33
public void GetNextAction_NewInstance_ReturnsFalse()
36
ProcessPackageAction action = null;
37
bool result = actions.GetNextAction(out action);
39
Assert.IsFalse(result);
43
public void GetNextAction_OneActionAdded_ReturnsActionInOutParameter()
46
ProcessPackageAction expectedAction = AddAction();
48
ProcessPackageAction action = null;
49
actions.GetNextAction(out action);
51
Assert.AreEqual(expectedAction, action);
55
public void GetNextAction_OneActionAdded_ReturnsTrue()
58
ProcessPackageAction expectedAction = AddAction();
60
ProcessPackageAction action = null;
61
bool result = actions.GetNextAction(out action);
63
Assert.IsTrue(result);
67
public void GetNextAction_CalledTwiceWithOneActionAdded_ReturnsNullActionInOutParameterOnSecondCall()
70
ProcessPackageAction expectedAction = AddAction();
71
ProcessPackageAction action = null;
72
actions.GetNextAction(out action);
73
actions.GetNextAction(out action);
75
Assert.IsNull(action);
79
public void GetNextAction_CalledTwiceWithOneActionAdded_ReturnsFalseOnSecondCall()
82
ProcessPackageAction expectedAction = AddAction();
84
ProcessPackageAction action = null;
85
actions.GetNextAction(out action);
86
bool result = actions.GetNextAction(out action);
88
Assert.IsFalse(result);
92
public void GetNextAction_CalledTwiceWithTwoActionsAdded_ReturnsSecondActionAddedInOutParameter()
96
ProcessPackageAction expectedAction = AddAction();
97
ProcessPackageAction action = null;
98
actions.GetNextAction(out action);
99
actions.GetNextAction(out action);
101
Assert.AreEqual(expectedAction, action);
105
public void GetNextAction_CalledTwiceWithTwoActionsAdded_ReturnsTrueOnSecondCall()
109
ProcessPackageAction expectedAction = AddAction();
110
ProcessPackageAction action = null;
111
actions.GetNextAction(out action);
112
bool result = actions.GetNextAction(out action);
114
Assert.IsTrue(result);