public void _ClientDropDown_UnAuthorisedUser_DoesNotSet_AuthenticationTicketInCookie()
        {
            // Arrange
            const int clientGroupId       = 5;
            var       clientDropdownModel = new ClientDropDown()
            {
                ClientGroups = new List <ClientGroup>()
                {
                    new ClientGroup()
                    {
                        ClientGroupID = clientGroupId
                    }
                },
                SelectedClientID      = 4,
                CurrentClientID       = 6,
                CurrentClientGroupID  = 99,
                SelectedClientGroupID = 99
            };

            var expectedAuthenticationTicketHash = "Authentication ticket hash";

            SetupShimsFor_ClientDropdownTest(clientGroupId, expectedAuthenticationTicketHash, false, false);
            ShimUser.IsChannelAdministratorUser = (_) => false;

            // Act
            _controller._ClientDropDown(clientDropdownModel);

            // Assert
            _controller.Response.Cookies[FormsAuthentication.FormsCookieName].ShouldBeNull();
        }
        public void _ClientDropDown_AuthorisedUserClientGroupChange_sets_AuthenticationTicketInCookie()
        {
            // Arrange
            const int clientGroupId       = 5;
            var       clientDropdownModel = new ClientDropDown()
            {
                CurrentClientGroupID  = 99,
                SelectedClientGroupID = 3,
                ClientGroups          = new List <ClientGroup>()
                {
                    new ClientGroup()
                    {
                        ClientGroupID = clientGroupId
                    }
                }
            };

            var expectedAuthenticationTicketHash = "Authentication ticket hash";

            SetupShimsFor_ClientDropdownTest(clientGroupId, expectedAuthenticationTicketHash, true, false);
            ShimUser.IsChannelAdministratorUser = (_) => true;

            // Act
            _controller._ClientDropDown(clientDropdownModel);

            // Assert
            _controller.Response.Cookies[FormsAuthentication.FormsCookieName].Value.ShouldBe(expectedAuthenticationTicketHash);
            _authenticationUserData.ShouldBe("-1,,3,10,00000000-0000-0000-0000-000000000000");
        }
Esempio n. 3
0
 private void ClearForm()
 {
     textBoxNotes.Clear();
     ClientDropDown.ResetText();
     ClientDropDown.Items.Clear();
     ProjectDropDown.ResetText();
     ProjectDropDown.Items.Clear();
     UpdateClientDropDown();
     addedTime = new TimeSpan(0, 0, 0);
     stopWatch.Reset();
     textBoxTime.Text = "00:00:00";
     button1.Text     = ">";
 }