Ejemplo n.º 1
0
        public async Task TestSendAuthLink()
        {
            var userService = new UserService(
                _randomGeneratorService,
                _userRepository,
                _authLinksRepository,
                new MokeEmailingService((email, message) =>
            {
                Assert.AreEqual(email, FakeMail);
                Assert.AreEqual(message, $"host/users/auth?key={RandomValue}");
            }),
                _options
                );
            await userService.SendAuthLink(FakeMail);

            var expected = new AuthLink
            {
                Email = FakeMail,
                Link  = RandomValue,
            };
            var actual = _authLinksRepository._links.First();

            Assert.AreEqual(expected.Email, actual.Email);
            Assert.AreEqual(expected.Link, actual.Link);
        }
Ejemplo n.º 2
0
        public async Task <AuthLink> CreateLink(string email, string link, DateTime expires)
        {
            var authLink = new AuthLink
            {
                Email   = email,
                Link    = link,
                Expires = expires,
            };
            await _ctx.LinksToAuth.AddAsync(authLink);

            return(authLink);
        }
Ejemplo n.º 3
0
        private void OnFocusChanged(object sender, AutomationFocusChangedEventArgs e)
        {
            if (ActivityLog.Count > 0)
            {
                foreach (appLog log in ActivityLog)
                {
                    log.StopStopwatch();
                }
            }
            AutomationElement focusedElement = sender as AutomationElement;

            if (focusedElement != null)
            {
                int processId = focusedElement.Current.ProcessId;
                using (Process process = Process.GetProcessById(processId))
                {
                    if (ActivityLog.Count > 0)
                    {
                        bool goingFurther = true;
                        foreach (appLog log in ActivityLog.ToArray())
                        {
                            if (log.name == process.ProcessName)
                            {
                                log.StartStopwatch();
                                goingFurther = false;
                            }
                        }
                        if (goingFurther)
                        {
                            AuthLink.RefreshUserDetails();

                            appLog newAppLog = new appLog(process.ProcessName, AuthLink.User.LocalId);
                            ActivityLog.Add(newAppLog);
                        }
                    }
                    else
                    {
                        AuthLink.RefreshUserDetails();

                        appLog newAppLog = new appLog(process.ProcessName, AuthLink.User.LocalId);
                        ActivityLog.Add(newAppLog);
                    }
                }
            }
        }