File tree 2 files changed +46
-1
lines changed
src/Atc.Cosmos.EventStore.Cqrs
test/Atc.Cosmos.EventStore.Cqrs.Tests
2 files changed +46
-1
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ public EventStreamId(EventStreamId existing)
31
31
public string Value { get ; }
32
32
33
33
public static implicit operator EventStreamId ( StreamId id )
34
- => FromStreamId ( id . Value ) ;
34
+ => FromStreamId ( id ) ;
35
35
36
36
public static EventStreamId FromStreamId ( StreamId id )
37
37
=> new (
Original file line number Diff line number Diff line change
1
+ using FluentAssertions ;
2
+ using Xunit ;
3
+
4
+ namespace Atc . Cosmos . EventStore . Cqrs . Commands . Tests ;
5
+
6
+ public class EventStreamIdTests
7
+ {
8
+ [ Fact ]
9
+ public void Ctor_must_throw_when_no_arguments_are_provided ( )
10
+ {
11
+ Assert . Throws < ArgumentException > ( ( ) => new EventStreamId ( ) ) ;
12
+ }
13
+
14
+ [ Fact ]
15
+ public void Value_property_must_return_joined_parts ( )
16
+ {
17
+ var id = new EventStreamId ( "foo" , "bar" ) ;
18
+ id . Value . Should ( ) . Be ( "foo.bar" ) ;
19
+ }
20
+
21
+ [ Fact ]
22
+ public void Parts_property_must_return_parts ( )
23
+ {
24
+ var id = new EventStreamId ( "foo" , "bar" ) ;
25
+ id . Parts . Should ( ) . BeEquivalentTo ( "foo" , "bar" ) ;
26
+ }
27
+
28
+ [ Fact ]
29
+ public void EventStreamId_can_be_cloned_using_ctor ( )
30
+ {
31
+ var id = new EventStreamId ( "foo" , "bar" ) ;
32
+ var clone = new EventStreamId ( id ) ;
33
+ id . Value . Should ( ) . Be ( clone . Value ) ;
34
+ }
35
+
36
+ [ Fact ]
37
+ public void EventStreamId_can_be_created_from_StreamId ( )
38
+ {
39
+ var streamId = new StreamId ( "foo.bar" ) ;
40
+ EventStreamId eventStreamId = streamId ;
41
+ EventStreamId eventStreamId2 = EventStreamId . FromStreamId ( streamId ) ;
42
+ eventStreamId . Value . Should ( ) . Be ( "foo.bar" ) ;
43
+ eventStreamId2 . Value . Should ( ) . Be ( "foo.bar" ) ;
44
+ }
45
+ }
You can’t perform that action at this time.
0 commit comments