File tree Expand file tree Collapse file tree 4 files changed +74
-0
lines changed
Expand file tree Collapse file tree 4 files changed +74
-0
lines changed Original file line number Diff line number Diff line change 1+ using FluentAssertions ;
2+ using Xunit ;
3+
4+ namespace StructLinq . Tests
5+ {
6+ public class EmptyTests
7+ {
8+ [ Fact ]
9+ public void ShouldBeEmpty ( )
10+ {
11+ StructEnumerable . Empty < int > ( )
12+ . ToArray ( )
13+ . Should ( )
14+ . BeEmpty ( ) ;
15+ }
16+ }
17+ }
Original file line number Diff line number Diff line change 1+ using System . Runtime . CompilerServices ;
2+
3+ namespace StructLinq . Empty
4+ {
5+ public struct EmptyEnumerable < T > : IStructEnumerable < T , EmptyEnumerator < T > >
6+ {
7+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
8+ public readonly EmptyEnumerator < T > GetEnumerator ( )
9+ {
10+ return new EmptyEnumerator < T > ( ) ;
11+ }
12+ }
13+ }
Original file line number Diff line number Diff line change 1+ using System ;
2+ using System . Runtime . CompilerServices ;
3+
4+ namespace StructLinq . Empty
5+ {
6+ public struct EmptyEnumerator < T > : IStructEnumerator < T >
7+ {
8+ public void Dispose ( )
9+ {
10+ }
11+
12+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
13+ public bool MoveNext ( )
14+ {
15+ return false ;
16+ }
17+
18+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
19+ public void Reset ( )
20+ {
21+ }
22+
23+ public T Current
24+ {
25+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
26+ get => throw new NotImplementedException ( ) ;
27+ }
28+ }
29+ }
Original file line number Diff line number Diff line change 1+ using System . Runtime . CompilerServices ;
2+ using StructLinq . Empty ;
3+
4+ // ReSharper disable once CheckNamespace
5+ namespace StructLinq
6+ {
7+ public static partial class StructEnumerable
8+ {
9+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
10+ public static EmptyEnumerable < T > Empty < T > ( )
11+ {
12+ return new EmptyEnumerable < T > ( ) ;
13+ }
14+ }
15+ }
You can’t perform that action at this time.
0 commit comments