11// Copyright (c) .NET Foundation. All rights reserved.
22// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33
4+ using System . Collections . Generic ;
45using Xunit ;
56
67namespace NuGetGallery . Services
78{
89 public class AccessConditionWrapperFacts
910 {
1011 [ Theory ]
11- [ InlineData ( "*" ) ]
12- [ InlineData ( "\" some-etag\" " ) ]
13- [ InlineData ( "no quotes" ) ]
14- [ InlineData ( "" ) ]
15- [ InlineData ( null ) ]
12+ [ MemberData ( nameof ( ETags ) ) ]
1613 public void GenerateIfMatchCondition ( string etag )
1714 {
1815 var actual = AccessConditionWrapper . GenerateIfMatchCondition ( etag ) ;
@@ -21,6 +18,16 @@ public void GenerateIfMatchCondition(string etag)
2118 Assert . Null ( actual . IfNoneMatchETag ) ;
2219 }
2320
21+ [ Theory ]
22+ [ MemberData ( nameof ( ETags ) ) ]
23+ public void GenerateIfNoneMatchCondition ( string etag )
24+ {
25+ var actual = AccessConditionWrapper . GenerateIfNoneMatchCondition ( etag ) ;
26+
27+ Assert . Null ( actual . IfMatchETag ) ;
28+ Assert . Equal ( etag , actual . IfNoneMatchETag ) ;
29+ }
30+
2431 [ Fact ]
2532 public void GenerateIfNotExistsCondition ( )
2633 {
@@ -38,5 +45,14 @@ public void GenerateEmptyCondition()
3845 Assert . Null ( actual . IfMatchETag ) ;
3946 Assert . Null ( actual . IfNoneMatchETag ) ;
4047 }
48+
49+ public static IEnumerable < object [ ] > ETags => new [ ]
50+ {
51+ new object [ ] { "*" } ,
52+ new object [ ] { "\" some-etag\" " } ,
53+ new object [ ] { "no quotes" } ,
54+ new object [ ] { "" } ,
55+ new object [ ] { null } ,
56+ } ;
4157 }
4258}
0 commit comments