public void TestUpdateSalon() { test = new GiftCardMSSQLDAO(); var salon = createTestCompanyModel(); Assert.IsTrue(test.UpdateSalon(salon)); var testsalon = test.retrieveClients(); Assert.IsTrue(testsalon.Count > 0); var foundsalon = testsalon.Find(i => i.CompanyName.Equals(salon.CompanyName)); Assert.IsNotNull(foundsalon); Assert.AreEqual <String>(foundsalon.CompanyAddress.AddressOne, salon.CompanyAddress.AddressOne); Assert.IsTrue(salon.Id.HasValue); }
public void TestSaveAuthInfo() { test = new GiftCardMSSQLDAO(); var salon = createTestCompanyModel(); Assert.IsTrue(test.UpdateSalon(salon)); var testsalon = test.retrieveClients(); Assert.IsTrue(testsalon.Count > 0); var foundsalon = testsalon.Find(i => i.CompanyName.Equals(salon.CompanyName)); string username = "******" + DateTime.Now.Second; string password = "******" + DateTime.Now.Millisecond; var enc = Encoding.Default; SHA256 mySHA256 = SHA256Managed.Create(); Assert.IsTrue(test.SaveAuthInfo(foundsalon.Id.Value, username, mySHA256.ComputeHash(enc.GetBytes(password)))); var hash = mySHA256.ComputeHash(enc.GetBytes(password)); var d = test.CheckPassword(foundsalon.Id.Value, username, hash); Assert.IsNotNull(d); Assert.IsTrue(d, "SELECT password_len FROM AuthInfo WHERE salon_id=" + foundsalon.Id.Value + " AND username='******'\n AND password=" + Convert.ToBase64String(hash)); }