Line data Source code
1 : using System;
2 : using cdmdotnet.Logging;
3 : using Cqrs.Domain;
4 : using Cqrs.Domain.Exceptions;
5 : using Cqrs.Domain.Factories;
6 : using Cqrs.Authentication;
7 : using Cqrs.Tests.Substitutes;
8 : using NUnit.Framework;
9 :
10 : namespace Cqrs.Tests.Domain
11 : {
12 : [TestFixture]
13 : public class When_saving_events_without_id
14 0 : {
15 : private TestInMemoryEventStore _eventStore;
16 : private TestAggregate _aggregate;
17 : private TestEventPublisher _eventPublisher;
18 : private Repository<ISingleSignOnToken> _rep;
19 :
20 : [SetUp]
21 0 : public void Setup()
22 : {
23 : _eventStore = new TestInMemoryEventStore();
24 : _eventPublisher = new TestEventPublisher();
25 : var dependencyResolver = new TestDependencyResolver(null);
26 : var aggregateFactory = new AggregateFactory(dependencyResolver, dependencyResolver.Resolve<ILogger>());
27 : _rep = new Repository<ISingleSignOnToken>(aggregateFactory, _eventStore, _eventPublisher, new NullCorrelationIdHelper());
28 :
29 : _aggregate = new TestAggregate(Guid.Empty);
30 :
31 : }
32 :
33 : [Test]
34 0 : public void Should_throw_aggregate_or_event_missing_id_exception_from_repository()
35 : {
36 : Assert.Throws<AggregateOrEventMissingIdException>(() => _rep.Save(_aggregate, 0));
37 : }
38 : }
39 : }
|