예제 #1
0
        public WhenAUserStartsARestingPhase()
        {
            Controller.Post(Request, TimeWarpCommand.Rest);

            FakeNowProvider.Now = new DateTime(2000, 12, 12, 12, 12, 0, 5);
            _result             = Controller.Get(Request);
        }
예제 #2
0
        public void ThenAnEventIsRaisedToNotifyTheUi()
        {
            var mockUserStateService = new MockUserStateService();

            using (var userStatePresenter = new UserStateListener(mockUserStateService, null))
            {
                userStatePresenter.Start();

                bool success;
                using (var manualResetEvent = new ManualResetEvent(false))
                {
                    userStatePresenter.UserStateChanged += (sender, e) => manualResetEvent.Set();

                    var workingState = new UserStateInfoResponse(1, "test", new DateTime(2000, 12, 12),
                                                                 TimeWarpState.Working, new DateTime(2000, 12, 12),
                                                                 TimeSpan.FromSeconds(12), 0.2, true, TimeWarpAgent.VisualStudio);
                    mockUserStateService.SetUserState(workingState);

                    success = manualResetEvent.WaitOne(TimeSpan.FromSeconds(10));
                }

                Assert.IsTrue(success);
                Assert.AreEqual(TimeWarpState.Working, userStatePresenter.CurrentTimeWarpState);
            }
        }
예제 #3
0
 public WhenAUserLogsIn()
 {
     CreateAccount();
     Logout();
     Login();
     StartWork();
     _result = GetCurrentState();
 }
예제 #4
0
 public WhenAUserStartsToWorkFromANewAgent()
 {
     CreateAccount();
     StartRest(TimeWarpAgent.VisualStudio);
     Thread.Sleep(1500);
     StartWork(TimeWarpAgent.LinuxClient);
     _result = GetCurrentState();
 }
예제 #5
0
 public WhenAnAccountIsCreatedWithNoPassword()
 {
     CreateAccountWithNoPassword();
     Logout();
     LoginWithNoPassword();
     StartWork();
     _result = GetCurrentState();
 }
예제 #6
0
        public void Update(UserStateInfoResponse userStateInfoResponse)
        {
            if (userStateInfoResponse.AccountId != AccountId)
            {
                return;
            }

            Progress = userStateInfoResponse.Progress;
        }
예제 #7
0
 public WhenAUserIsWorking()
 {
     CreateAccount();
     StartWork();
     _result1 = GetCurrentState();
     Thread.Sleep(TimeSpan.FromMilliseconds(100));
     _result2 = GetCurrentState();
     Thread.Sleep(TimeSpan.FromMilliseconds(100));
     _result3 = GetCurrentState();
 }
        public void Update(UserStateInfoResponse userStateInfoResponse)
        {
            if (userStateInfoResponse.AccountId != AccountId)
            {
                return;
            }

            Progress = (int)((1 - userStateInfoResponse.Progress) * 100);
            //Username = userStateInfoResponse.Username.Length;
            //if(!_isCurrentUser)
            //    SortString = Username;

            RemainingTime        = userStateInfoResponse.TimeLeft.Minutes.ToString(CultureInfo.InvariantCulture);
            CurrentState         = userStateInfoResponse.State;
            NotificationsEnabled = userStateInfoResponse.State == TimeWarpState.Working ? Visibility.Visible : Visibility.Collapsed;
        }
예제 #9
0
 public void SetUserState(UserStateInfoResponse userStateInfoResponse)
 {
     _userStateInfoResponse = userStateInfoResponse;
 }
예제 #10
0
 public WhenAUserStartsToWork()
 {
     CreateAccount();
     StartWork();
     _result = GetCurrentState();
 }
 public WhenUserInformationIsRetrieved()
 {
     FakeNowProvider.Now = new DateTime(2000, 12, 12, 12, 12, 0, 5);
     _result             = Controller.Get(Request);
 }
예제 #12
0
 public WhenAUserStartsToRest()
 {
     CreateAccount();
     StartRest(TimeWarpAgent.VisualStudio);
     _result = GetCurrentState();
 }