@@ -29,152 +29,9 @@ public CertificateTests(Xunit.Abstractions.ITestOutputHelper output)
2929
3030 [ Fact ]
3131 [ Trait ( Category . AcceptanceType , Category . CheckIn ) ]
32- public void TestAddCertificate ( )
32+ public void TestCertificateCrudOperations ( )
3333 {
34- BatchController . NewInstance . RunPsTest ( "Test-AddCertificate" ) ;
35- }
36-
37- [ Fact ]
38- public void TestGetCertificateByThumbprint ( )
39- {
40- BatchController controller = BatchController . NewInstance ;
41- BatchAccountContext context = null ;
42- string thumbprint = null ;
43- controller . RunPsTestWorkflow (
44- ( ) => { return new string [ ] { string . Format ( "Test-GetCertificateByThumbprint '{0}' '{1}'" , BatchTestHelpers . TestCertificateAlgorithm , thumbprint ) } ; } ,
45- ( ) =>
46- {
47- context = new ScenarioTestContext ( ) ;
48- thumbprint = ScenarioTestHelpers . AddTestCertificate ( controller , context , BatchTestHelpers . TestCertificateFileName1 ) ;
49- } ,
50- ( ) =>
51- {
52- ScenarioTestHelpers . DeleteTestCertificate ( controller , context , BatchTestHelpers . TestCertificateAlgorithm , thumbprint ) ;
53- } ,
54- TestUtilities . GetCallingClass ( ) ,
55- TestUtilities . GetCurrentMethodName ( ) ) ;
56- }
57-
58- [ Fact ]
59- public void TestListCertificatesByFilter ( )
60- {
61- BatchController controller = BatchController . NewInstance ;
62- BatchAccountContext context = null ;
63- string state = "active" ;
64- string thumbprint1 = null ;
65- string toDeleteThumbprint = null ;
66- int matchCount = 1 ;
67- controller . RunPsTestWorkflow (
68- ( ) => { return new string [ ] { string . Format ( "Test-ListCertificatesByFilter '{0}' '{1}' '{2}'" , state , toDeleteThumbprint , matchCount ) } ; } ,
69- ( ) =>
70- {
71- context = new ScenarioTestContext ( ) ;
72- thumbprint1 = ScenarioTestHelpers . AddTestCertificate ( controller , context , BatchTestHelpers . TestCertificateFileName1 ) ;
73- toDeleteThumbprint = ScenarioTestHelpers . AddTestCertificate ( controller , context , BatchTestHelpers . TestCertificateFileName2 ) ;
74- } ,
75- ( ) =>
76- {
77- ScenarioTestHelpers . DeleteTestCertificate ( controller , context , BatchTestHelpers . TestCertificateAlgorithm , thumbprint1 ) ;
78- // Other cert is deleted as the first part of the PowerShell test script, but we ensure it's gone.
79- try
80- {
81- ScenarioTestHelpers . DeleteTestCertificate ( controller , context , BatchTestHelpers . TestCertificateAlgorithm , toDeleteThumbprint ) ;
82- }
83- catch { }
84- } ,
85- TestUtilities . GetCallingClass ( ) ,
86- TestUtilities . GetCurrentMethodName ( ) ) ;
87- }
88-
89- [ Fact ]
90- [ Trait ( Category . AcceptanceType , Category . CheckIn ) ]
91- public void TestGetAndListCertificatesWithSelect ( )
92- {
93- BatchController controller = BatchController . NewInstance ;
94- BatchAccountContext context = null ;
95- string thumbprint = null ;
96- controller . RunPsTestWorkflow (
97- ( ) => { return new string [ ] { string . Format ( "Test-GetAndListCertificatesWithSelect '{0}' '{1}'" , BatchTestHelpers . TestCertificateAlgorithm , thumbprint ) } ; } ,
98- ( ) =>
99- {
100- context = new ScenarioTestContext ( ) ;
101- thumbprint = ScenarioTestHelpers . AddTestCertificate ( controller , context , BatchTestHelpers . TestCertificateFileName1 ) ;
102- } ,
103- ( ) =>
104- {
105- ScenarioTestHelpers . DeleteTestCertificate ( controller , context , BatchTestHelpers . TestCertificateAlgorithm , thumbprint ) ;
106- } ,
107- TestUtilities . GetCallingClass ( ) ,
108- TestUtilities . GetCurrentMethodName ( ) ) ;
109- }
110-
111- [ Fact ]
112- public void TestListCertificatesWithMaxCount ( )
113- {
114- BatchController controller = BatchController . NewInstance ;
115- BatchAccountContext context = null ;
116- int maxCount = 1 ;
117- string thumbprint1 = null ;
118- string thumbprint2 = null ;
119- controller . RunPsTestWorkflow (
120- ( ) => { return new string [ ] { string . Format ( "Test-ListCertificatesWithMaxCount '{0}'" , maxCount ) } ; } ,
121- ( ) =>
122- {
123- context = new ScenarioTestContext ( ) ;
124- thumbprint1 = ScenarioTestHelpers . AddTestCertificate ( controller , context , BatchTestHelpers . TestCertificateFileName1 ) ;
125- thumbprint2 = ScenarioTestHelpers . AddTestCertificate ( controller , context , BatchTestHelpers . TestCertificateFileName2 ) ;
126- } ,
127- ( ) =>
128- {
129- ScenarioTestHelpers . DeleteTestCertificate ( controller , context , BatchTestHelpers . TestCertificateAlgorithm , thumbprint1 ) ;
130- ScenarioTestHelpers . DeleteTestCertificate ( controller , context , BatchTestHelpers . TestCertificateAlgorithm , thumbprint2 ) ;
131- } ,
132- TestUtilities . GetCallingClass ( ) ,
133- TestUtilities . GetCurrentMethodName ( ) ) ;
134- }
135-
136- [ Fact ]
137- public void TestListAllCertificates ( )
138- {
139- BatchController controller = BatchController . NewInstance ;
140- BatchAccountContext context = null ;
141- int count = 2 ;
142- string thumbprint1 = null ;
143- string thumbprint2 = null ;
144- controller . RunPsTestWorkflow (
145- ( ) => { return new string [ ] { string . Format ( "Test-ListAllCertificates '{0}'" , count ) } ; } ,
146- ( ) =>
147- {
148- context = new ScenarioTestContext ( ) ;
149- thumbprint1 = ScenarioTestHelpers . AddTestCertificate ( controller , context , BatchTestHelpers . TestCertificateFileName1 ) ;
150- thumbprint2 = ScenarioTestHelpers . AddTestCertificate ( controller , context , BatchTestHelpers . TestCertificateFileName2 ) ;
151- } ,
152- ( ) =>
153- {
154- ScenarioTestHelpers . DeleteTestCertificate ( controller , context , BatchTestHelpers . TestCertificateAlgorithm , thumbprint1 ) ;
155- ScenarioTestHelpers . DeleteTestCertificate ( controller , context , BatchTestHelpers . TestCertificateAlgorithm , thumbprint2 ) ;
156- } ,
157- TestUtilities . GetCallingClass ( ) ,
158- TestUtilities . GetCurrentMethodName ( ) ) ;
159- }
160-
161- [ Fact ]
162- [ Trait ( Category . AcceptanceType , Category . CheckIn ) ]
163- public void TestDeleteCertificate ( )
164- {
165- BatchController controller = BatchController . NewInstance ;
166- BatchAccountContext context = null ;
167- string thumbprint = null ;
168- controller . RunPsTestWorkflow (
169- ( ) => { return new string [ ] { string . Format ( "Test-DeleteCertificate '{0}' '{1}'" , BatchTestHelpers . TestCertificateAlgorithm , thumbprint ) } ; } ,
170- ( ) =>
171- {
172- context = new ScenarioTestContext ( ) ;
173- thumbprint = ScenarioTestHelpers . AddTestCertificate ( controller , context , BatchTestHelpers . TestCertificateFileName1 ) ;
174- } ,
175- null ,
176- TestUtilities . GetCallingClass ( ) ,
177- TestUtilities . GetCurrentMethodName ( ) ) ;
34+ BatchController . NewInstance . RunPsTest ( "Test-CertificateCrudOperations" ) ;
17835 }
17936
18037 [ Fact ]
@@ -189,7 +46,7 @@ public void TestCancelCertificateDelete()
18946 ( ) =>
19047 {
19148 context = new ScenarioTestContext ( ) ;
192- thumbprint = ScenarioTestHelpers . AddTestCertificate ( controller , context , BatchTestHelpers . TestCertificateFileName1 ) ;
49+ thumbprint = ScenarioTestHelpers . AddTestCertificate ( controller , context , BatchTestHelpers . TestCertificateFileName ) ;
19350 CertificateReference certRef = new CertificateReference ( ) ;
19451 certRef . StoreLocation = CertStoreLocation . CurrentUser ;
19552 certRef . StoreName = "My" ;
0 commit comments