public async Task HandleDomainCreatedCreatesDomain()
        {
            A.CallTo(() => _spfHistoryEntityDao.Get(Id)).Returns <SpfHistoryEntityState>(null);
            await _spfEntityHistory.Handle(new DomainCreated(Id, "*****@*****.**", DateTime.Now));

            A.CallTo(() => _spfHistoryEntityDao.Save(A <SpfHistoryEntityState> ._)).MustHaveHappenedOnceExactly();
        }
        public async Task Handle(DomainCreated message)
        {
            string messageId = message.Id.ToLower();

            SpfHistoryEntityState state = await _dao.Get(messageId);

            if (state == null)
            {
                state = new SpfHistoryEntityState(messageId);
                await _dao.Save(state);

                _log.LogInformation("Created SpfEntityHistory for {Id}.", messageId);
            }
            else
            {
                _log.LogWarning("Ignoring {EventName} as SpfEntityHistory already exists for {Id}.",
                                nameof(DomainCreated), messageId);
                ;
            }
        }
Ejemplo n.º 3
0
        public async Task GetNoStateExistsReturnsNull()
        {
            SpfHistoryEntityState state = await _dao.Get(Id);

            Assert.That(state, Is.Null);
        }