-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathlistWrapCommand.cs
More file actions
130 lines (121 loc) · 4.62 KB
/
listWrapCommand.cs
File metadata and controls
130 lines (121 loc) · 4.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using OpenWrap;
using OpenWrap.Commands.contexts;
using OpenWrap.Commands.Wrap;
using OpenWrap.PackageManagement;
using OpenWrap.Testing;
namespace listWrap_specs
{
public class filtering_project_package_list_by_name : command_context<ListWrapCommand>
{
public filtering_project_package_list_by_name()
{
given_project_package("one-ring", "1.0");
given_project_package("sauron", "2.0");
given_dependency("depends: one-ring");
given_dependency("depends: sauron");
when_executing_command("one*");
}
[Test]
public void matching_package_is_returned()
{
Results.OfType<PackageFoundCommandOutput>()
.ShouldHaveCountOf(1)
.First().Name.ShouldBe("one-ring");
}
}
public class filtering_project_with_different_casing : command_context<ListWrapCommand>
{
public filtering_project_with_different_casing()
{
given_project_package("one-ring", "1.0");
given_dependency("depends: one-ring");
when_executing_command("*Rin*");
}
[Test]
public void casing_is_ignored()
{
Results.OfType<PackageFoundCommandOutput>()
.ShouldHaveCountOf(1)
.First().Name.ShouldBe("one-ring");
}
}
public class listing_packages_from_all_repositories : command_context<ListWrapCommand>
{
public listing_packages_from_all_repositories()
{
given_remote_repository("first");
given_remote_repository("second");
given_remote_package("first", "one-ring", "1.0.0".ToVersion());
given_remote_package("second", "ring-of-power", "1.0.0".ToVersion());
when_executing_command("ring", "-remote");
}
[Test]
public void packages_are_found_in_any_remote()
{
Results.OfType<PackageFoundCommandOutput>()
.ShouldHaveCountOf(2)
.Check(x => x.ShouldHaveAtLeastOne(n => n.Name.Equals("one-ring")))
.Check(x => x.ShouldHaveAtLeastOne(n => n.Name.Equals("ring-of-power")));
}
}
public class listing_packages_with_detailed_option : command_context<ListWrapCommand>
{
public listing_packages_with_detailed_option()
{
given_project_package("one-ring", "1.1", "desc 1.1");
given_project_package("sauron", "2.0");
given_dependency("depends: one-ring");
given_dependency("depends: sauron");
when_executing_command("one*", "-detailed");
}
[Test]
public void correct_description_is_returned()
{
Results.OfType<PackageFoundCommandOutput>()
.ShouldHaveCountOf(1)
.First().ToString().ShouldContain("desc 1.1");
}
}
public class listing_packages_will_hightlight_current : command_context<ListWrapCommand>
{
public listing_packages_will_hightlight_current()
{
given_project_package("one-ring", "1.0");
given_remote_package("one-ring", "1.0".ToVersion());
given_remote_package("one-ring", "1.1".ToVersion());
given_remote_package("one-ring-rules-them-all", "1.1".ToVersion());
given_project_package("sauron", "2.0");
given_dependency("depends: one-ring");
given_dependency("depends: sauron");
when_executing_command("*n*", "-remote");
}
[Test]
public void correct_version_is_highlighted()
{
var s = Results.OfType<PackageFoundCommandOutput>()
.ShouldHaveCountOf(2)
.First().ToString();
Console.WriteLine(s);
s.ShouldContain("current: 1.0");
}
[Test]
public void current_version_is_still_listed_as_available()
{
Results.OfType<PackageFoundCommandOutput>()
.ShouldHaveCountOf(2)
.First().ToString().ShouldContain("available: 1.0, 1.1");
}
[Test]
public void current_version_list_only_for_installed_package()
{
Results.OfType<PackageFoundCommandOutput>()
.ShouldHaveCountOf(2)
.ElementAt(1).ToString().ShouldNotContain("current: ");
}
}
}