示例#1
0
 public void Setup()
 {
     _accountsMasterPage        = new AccountsMasterPage();
     _accountsMasterPagePrivate = new PrivateObject(_accountsMasterPage);
     _siteMapSecondLevelField   = new SiteMapDataSource();
     _menuField    = new Menu();
     _shimsContext = ShimsContext.Create();
     InitializeFields();
 }
        public void Accounts_Class_Invalid_Property_virtualPathNotPresent_Access_Using_Reflexion_Doesnt_Throw_Exception_Test()
        {
            // Arrange
            const string propertyNamevirtualPath = "virtualPathNotPresent";
            var          accounts = new ecn.accounts.MasterPages.Accounts();

            // Act , Assert
            Should.NotThrow(() => accounts.GetType().GetProperty(propertyNamevirtualPath));
        }
        public void Accounts_HasAuthorized_Method_2_Parameters_Simple_Call_Test()
        {
            // Arrange
            var userId   = Fixture.Create <int>();
            var clientId = Fixture.Create <int>();
            var accounts = new ecn.accounts.MasterPages.Accounts();

            // Act, Assert
            Should.Throw <System.Exception>(() => accounts.HasAuthorized(userId, clientId));
        }
        public void Accounts_UserSession_Property_Setting_String_Throw_Argument_Exception_Test()
        {
            // Arrange
            const string propertyNameUserSession = "UserSession";
            var          accounts     = new ecn.accounts.MasterPages.Accounts();
            var          randomString = Fixture.Create <string>();
            var          propertyInfo = accounts.GetType().GetProperty(propertyNameUserSession);

            // Act , Assert
            propertyInfo.ShouldNotBeNull();
            Should.Throw <ArgumentException>(() => propertyInfo.SetValue(accounts, randomString, null));
        }
        public void Accounts_virtualPath_Property_Is_Present_In_Class_As_Public_Test()
        {
            // Arrange
            const string propertyNamevirtualPath = "virtualPath";
            var          accounts     = new ecn.accounts.MasterPages.Accounts();
            var          propertyInfo = accounts.GetType().GetProperty(propertyNamevirtualPath);

            // Act
            var canRead = propertyInfo.CanRead;

            // Assert
            propertyInfo.ShouldNotBeNull();
            canRead.ShouldBeTrue();
        }