Beispiel #1
0
        public async Task ShouldAddLogEntry()
        {
            // Arrange
            var entry = new AccountLogEntry
            {
                UserId    = "alexpvt",
                UserName  = "******",
                Email     = "*****@*****.**",
                Type      = AccountActionType.SignIn,
                EventDate = DateTimeNow
            };

            // Act
            await _accountLogService.AddLogAsync(entry);

            // Assert
            var dbEntry = Context.AccountLogEntries.Single();

            dbEntry.Id.ShouldNotBeNullOrEmpty();
            dbEntry.UserId.ShouldBeEqualTo("alexpvt");
            dbEntry.UserName.ShouldBeEqualTo("Alexander Pashnikov");
            dbEntry.Email.ShouldBeEqualTo("*****@*****.**");
            dbEntry.Type.ShouldBeEqualTo((int)AccountActionType.SignIn);
            dbEntry.EventDate.ShouldBeEqualTo(DateTimeNow);
        }
 /// <summary>
 /// Метод для обработки действий с аккаунтом
 /// </summary>
 /// <param name="message">Сообщение о действии с аккаунтом</param>
 /// <returns></returns>
 public async Task ConsumeAsync(AccountLogMessage message)
 {
     await _accountLogService.AddLogAsync(_mapper.Map <AccountLogEntry>(message));
 }