public void ConvertTo_TypeError2() { MachineKeyValidationConverter cv = new MachineKeyValidationConverter(); Assert.AreEqual("MD5", cv.ConvertTo(null, null, MachineKeyValidation.MD5, typeof(int)), "A1"); Assert.AreEqual("MD5", cv.ConvertTo(null, null, MachineKeyValidation.MD5, null), "A2"); }
public void ConvertTo() { MachineKeyValidationConverter cv = new MachineKeyValidationConverter(); Assert.AreEqual("MD5", cv.ConvertTo(null, null, MachineKeyValidation.MD5, typeof(string)), "A1"); Assert.AreEqual("SHA1", cv.ConvertTo(null, null, MachineKeyValidation.SHA1, typeof(string)), "A2"); Assert.AreEqual("3DES", cv.ConvertTo(null, null, MachineKeyValidation.TripleDES, typeof(string)), "A3"); }
public void ConvertTo() { MachineKeyValidationConverter cv = new MachineKeyValidationConverter(); Assert.AreEqual("MD5", cv.ConvertTo(null, null, MachineKeyValidation.MD5, typeof(string)), "A1"); Assert.AreEqual("SHA1", cv.ConvertTo(null, null, MachineKeyValidation.SHA1, typeof(string)), "A2"); Assert.AreEqual("3DES", cv.ConvertTo(null, null, MachineKeyValidation.TripleDES, typeof(string)), "A3"); #if NET_4_0 Assert.AreEqual("HMACSHA256", cv.ConvertTo(null, null, MachineKeyValidation.HMACSHA256, typeof(string)), "HMACSHA256"); Assert.AreEqual("HMACSHA384", cv.ConvertTo(null, null, MachineKeyValidation.HMACSHA384, typeof(string)), "HMACSHA384"); Assert.AreEqual("HMACSHA512", cv.ConvertTo(null, null, MachineKeyValidation.HMACSHA512, typeof(string)), "HMACSHA512"); #endif }
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 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)); }