static Membership() { MembershipSection section = (MembershipSection)WebConfigurationManager.GetSection("system.web/membership"); providers = new MembershipProviderCollection(); ProvidersHelper.InstantiateProviders(section.Providers, providers, typeof(MembershipProvider)); provider = providers[section.DefaultProvider]; onlineTimeWindow = (int)section.UserIsOnlineTimeWindow.TotalMinutes; hashAlgorithmType = section.HashAlgorithmType; if (String.IsNullOrEmpty(hashAlgorithmType)) { MachineKeySection mks = WebConfigurationManager.GetSection("system.web/machineKey") as MachineKeySection; MachineKeyValidationConverter cvt = new MachineKeyValidationConverter(); hashAlgorithmType = cvt.ConvertTo(null, null, mks.Validation, typeof(string)) as string; } if (String.IsNullOrEmpty(hashAlgorithmType)) { hashAlgorithmType = "SHA1"; } }
public void ConvertFrom_Custom() { MachineKeyValidationConverter cv = new MachineKeyValidationConverter(); cv.ConvertFrom(null, null, "Custom"); }
public void ConvertTo_TypeError3() { MachineKeyValidationConverter cv = new MachineKeyValidationConverter(); cv.ConvertTo(null, null, (MachineKeyValidation)Int32.MinValue, typeof(string)); }
public void ConvertTo_TypeError1() { MachineKeyValidationConverter cv = new MachineKeyValidationConverter(); Assert.AreEqual("6", cv.ConvertTo(null, null, 6, typeof(string)), "A1"); }
public void ConvertTo_Custom() { MachineKeyValidationConverter cv = new MachineKeyValidationConverter(); cv.ConvertTo(null, null, MachineKeyValidation.Custom, typeof(string)); }
public void ConvertFrom_CaseSensitive() { MachineKeyValidationConverter cv = new MachineKeyValidationConverter(); cv.ConvertFrom(null, null, "sha1"); }