public void LogoutSuccessful()
        {
            var id      = 1;
            var profile = new ProfileDbModel {
                Id = 1
            };
            var account = new AccountDbModel
            {
                Id       = 1,
                Login    = "******",
                Password = "******",
                Profile  = profile
            };
            var statistic = new StatisticDbModel()
            {
                AccountId = 2, AccountDbModel = account, DateLogIn = DateTime.Now, DateLogOut = null
            };
            var statistics = new List <StatisticDbModel> {
                statistic
            };

            _validator.Setup(v => v.Validate(It.IsAny <RegisterUserDto>()).IsValid).Returns(true);
            _emailService.Setup(x => x.SendConfirmation(It.IsAny <AccountConfirmationDto>()));

            _factoryRepository.Setup(x => x.Statistics.Find(It.IsAny <Expression <Func <StatisticDbModel, bool> > >()))
            .Returns(statistics);

            _factoryRepository.Setup(x => x.Statistics.Update(It.IsAny <StatisticDbModel>())).Returns(statistic);

            var userService = new AccountService(_factoryRepository.Object, _emailService.Object, this._validator.Object, _tokenValidatorMock.Object);

            Assert.IsNotNull(userService.Logout(1));
        }
        public void TestRegistrationSuccessfull()
        {
            var profile = new ProfileDbModel {
                Id = 1
            };
            var account = new AccountDbModel
            {
                Id       = 2,
                Login    = "******",
                Password = "******",
                Profile  = profile
            };

            _factoryRepository.Setup(x => x.Accounts.Add(It.IsAny <AccountDbModel>())).Returns(account);
            _factoryRepository.Setup(x => x.Accounts.Find(It.IsAny <Expression <Func <AccountDbModel, bool> > >()))
            .Returns((IEnumerable <AccountDbModel>)null);
            _validator.Setup(v => v.Validate(new RegisterUserDto()).IsValid).Returns(true);
            _emailService.Setup(x => x.SendConfirmation(It.IsAny <AccountConfirmationDto>()));

            var userService = new AccountService(_factoryRepository.Object, _emailService.Object, this._validator.Object, _tokenValidatorMock.Object);

            Assert.IsNotNull(userService.Register(_user));
        }