Inheritance: Castle.ActiveRecord.ActiveRecordValidationBase
Ejemplo n.º 1
0
		protected override void CreateTestData()
		{
			account1 = new Account("AdWords", "*****@*****.**", "abc123");
			account2 = new Account("AdWords", "*****@*****.**", "abc123");

			account1.Create();
			account2.Create();
		}
		protected override void CreateTestData()
		{
			account1 = new Account("AdWords", "*****@*****.**", "abc123");
			account2 = new Account("AdSense", "*****@*****.**", "abc123");
			account3 = new Account("Orkut", "*****@*****.**", "abc123");

			account1.Password = account2.Password = account3.Password = "******";
			account1.ConfirmationPassword = account2.ConfirmationPassword = account3.ConfirmationPassword = "******";

			account1.Create();
			account2.Create();
			account3.Create();
		}
Ejemplo n.º 3
0
		public void CreateAccount()
		{
			ie.GoTo("http://*****:*****@domain.com.", ie.Element("advice-required-account_email").InnerHtml);
			Assert.AreEqual("This is a required field.", ie.Element("advice-required-account_password").InnerHtml);

			// Passwords wont match
			ie.TextField("account_password").TypeText("123");
			ie.TextField("account_confirmationpassword").TypeText("321");

			Assert.IsTrue(ie.Elements.Exists("advice-validate-same-as-account_Password-account_confirmationpassword"));
			Assert.AreEqual("Fields do not match.", ie.Element("advice-validate-same-as-account_Password-account_confirmationpassword").InnerHtml);

			// This should fix it
			ie.TextField("account_password").TypeText("123987");
			ie.TextField("account_confirmationpassword").TypeText("123987");
		
			ie.TextField("account_name").TypeText("My first account");
			ie.TextField("account_email").TypeText("*****@*****.**");

			ie.SelectList("account_ProductLicense_id").SelectByValue(lic1.Id.ToString());

			ie.CheckBox("account_permissions").Checked = true;
			ie.CheckBox("account_Permissions_1_").Checked = true;

			ie.CheckBox("account_users").Checked = true;
			ie.CheckBox("account_Users_1_").Checked = true;

			ie.Button(Find.ByValue("Insert")).Click();

			var accountId = Convert.ToInt32(ie.Element("newid").InnerHtml);

			account = ActiveRecordMediator<Account>.FindByPrimaryKey(accountId);

			Assert.AreEqual("My first account", account.Name);
			Assert.AreEqual("*****@*****.**", account.Email);
			Assert.AreEqual("123987", account.Password);
			
			Assert.IsNotNull(account.ProductLicense);
			Assert.AreEqual(lic1.Id, account.ProductLicense.Id);
			
			Assert.AreEqual(2, account.Permissions.Count);
			Assert.AreEqual(2, account.Users.Count);
		}