@@ -100,6 +100,23 @@ public void TestEqualsIgnoreCase(string typeX, string subtypeX, string typeY, st
100100 public void TestEqualsIgnoreCase_String ( string typeX , string subtypeX , string other , bool expected )
101101 => Assert . AreEqual ( expected , new MimeType ( typeX , subtypeX ) . EqualsIgnoreCase ( other ) ) ;
102102
103+ [ TestCase ( "text" , "plain" , "text/plain" , StringComparison . Ordinal , true ) ]
104+ [ TestCase ( "text" , "plain" , "text/plain" , StringComparison . OrdinalIgnoreCase , true ) ]
105+ [ TestCase ( "text" , "plain" , "text/PLAIN" , StringComparison . Ordinal , false ) ]
106+ [ TestCase ( "text" , "plain" , "text/PLAIN" , StringComparison . OrdinalIgnoreCase , true ) ]
107+ [ TestCase ( "text" , "plain" , "TEXT/plain" , StringComparison . Ordinal , false ) ]
108+ [ TestCase ( "text" , "plain" , "TEXT/plain" , StringComparison . OrdinalIgnoreCase , true ) ]
109+ [ TestCase ( "text" , "plain" , "TEXT/PLAIN" , StringComparison . Ordinal , false ) ]
110+ [ TestCase ( "text" , "plain" , "TEXT/PLAIN" , StringComparison . OrdinalIgnoreCase , true ) ]
111+ [ TestCase ( "text" , "html" , "text/plain" , StringComparison . Ordinal , false ) ]
112+ [ TestCase ( "text" , "html" , "text/plain" , StringComparison . OrdinalIgnoreCase , false ) ]
113+ [ TestCase ( "image" , "plain" , "text/plain" , StringComparison . Ordinal , false ) ]
114+ [ TestCase ( "image" , "plain" , "text/plain" , StringComparison . OrdinalIgnoreCase , false ) ]
115+ [ TestCase ( "application" , "octet-stream" , "text/plain" , StringComparison . Ordinal , false ) ]
116+ [ TestCase ( "application" , "octet-stream" , "text/plain" , StringComparison . OrdinalIgnoreCase , false ) ]
117+ public void TestEquals_ReadOnlySpanOfChar ( string typeX , string subtypeX , string other , StringComparison comparison , bool expected )
118+ => Assert . AreEqual ( expected , new MimeType ( typeX , subtypeX ) . Equals ( other . AsSpan ( ) , comparison ) ) ;
119+
103120 [ TestCase ( "text" , "plain" , "text" , "plain" , true ) ]
104121 [ TestCase ( "text" , "plain" , "text" , "PLAIN" , true ) ]
105122 [ TestCase ( "text" , "plain" , "TEXT" , "plain" , false ) ]
@@ -130,6 +147,15 @@ public void TestTypeEquals_String(string typeX, string subtypeX, string typeY, b
130147 public void TestTypeEqualsIgnoreCase_String ( string typeX , string subtypeX , string typeY , bool expected )
131148 => Assert . AreEqual ( expected , new MimeType ( typeX , subtypeX ) . TypeEqualsIgnoreCase ( typeY ) ) ;
132149
150+ [ TestCase ( "text" , "plain" , "text" , StringComparison . Ordinal , true ) ]
151+ [ TestCase ( "text" , "plain" , "text" , StringComparison . OrdinalIgnoreCase , true ) ]
152+ [ TestCase ( "text" , "plain" , "TEXT" , StringComparison . Ordinal , false ) ]
153+ [ TestCase ( "text" , "plain" , "TEXT" , StringComparison . OrdinalIgnoreCase , true ) ]
154+ [ TestCase ( "text" , "plain" , "" , StringComparison . Ordinal , false ) ]
155+ [ TestCase ( "text" , "plain" , "" , StringComparison . OrdinalIgnoreCase , false ) ]
156+ public void TestTypeEquals_ReadOnlySpanOfChar ( string typeX , string subtypeX , string typeY , StringComparison comparison , bool expected )
157+ => Assert . AreEqual ( expected , new MimeType ( typeX , subtypeX ) . TypeEquals ( typeY . AsSpan ( ) , comparison ) ) ;
158+
133159 [ TestCase ( "text" , "plain" , "text" , "plain" , true ) ]
134160 [ TestCase ( "text" , "plain" , "text" , "PLAIN" , false ) ]
135161 [ TestCase ( "text" , "plain" , "TEXT" , "plain" , true ) ]
@@ -160,6 +186,15 @@ public void TestSubTypeEquals_String(string typeX, string subtypeX, string subty
160186 public void TestSubTypeEqualsIgnoreCase_String ( string typeX , string subtypeX , string subtypeY , bool expected )
161187 => Assert . AreEqual ( expected , new MimeType ( typeX , subtypeX ) . SubTypeEqualsIgnoreCase ( subtypeY ) ) ;
162188
189+ [ TestCase ( "text" , "plain" , "plain" , StringComparison . Ordinal , true ) ]
190+ [ TestCase ( "text" , "plain" , "plain" , StringComparison . OrdinalIgnoreCase , true ) ]
191+ [ TestCase ( "text" , "plain" , "PLAIN" , StringComparison . Ordinal , false ) ]
192+ [ TestCase ( "text" , "plain" , "PLAIN" , StringComparison . OrdinalIgnoreCase , true ) ]
193+ [ TestCase ( "text" , "plain" , "" , StringComparison . Ordinal , false ) ]
194+ [ TestCase ( "text" , "plain" , "" , StringComparison . OrdinalIgnoreCase , false ) ]
195+ public void TestSubTypeEquals_ReadOnlySpanOfChar ( string typeX , string subtypeX , string subtypeY , StringComparison comparison , bool expected )
196+ => Assert . AreEqual ( expected , new MimeType ( typeX , subtypeX ) . SubTypeEquals ( subtypeY . AsSpan ( ) , comparison ) ) ;
197+
163198 [ Test ]
164199 public void TestToString ( )
165200 {
0 commit comments