This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private void btnShowUserDialog_Click(object sender, EventArgs e) | |
| { | |
| var form = new SelectUserForm(); // Wrap in using block | |
| form.SelectedUsers = SelectedUsers; | |
| // Don't use a custom event. | |
| // Instead get the selected users after the ShowDialog() method returns. | |
| form.OkClick += SelectUserForm_OnOkClick; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private void btnOK_Click(object sender, EventArgs e) | |
| { | |
| if (Validate()) | |
| { | |
| _selectedUsers.Clear(); | |
| foreach (var user in _allUsers.Where(u => u.Selected)) | |
| _selectedUsers.Add(user.UserId, user.UserName); | |
| } | |
| else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public event EventHandler OkClick; // Eliminate custom event | |
| public bool Success { get; set; } // Eliminate custom flag | |
| private void btnOK_Click(object sender, EventArgs e) | |
| { | |
| if (Validate()) | |
| { | |
| _selectedUsers.Clear(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Given(@"the following address")] | |
| public void GivenTheFollowingAddress(Table table) | |
| { | |
| Address address = table.CreateInstance<Address>(); | |
| } | |
| [Then(@"the following address should be returned by the service")] | |
| public void ThenTheFollowingAddressShouldBeReturnedByTheService(Table table) | |
| { | |
| table.CompareToInstance(_address); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Given(@"the following address")] | |
| public void GivenTheFollowingAddress(Table table) | |
| { | |
| Address address = new Address(); | |
| address.Line1 = table.Rows[0]["Line 1"]; | |
| address.Line2 = table.Rows[0]["Line 2"]; | |
| address.City = table.Rows[0]["City"]; | |
| address.State = table.Rows[0]["State"]; | |
| address.Zipcode = table.Rows[0]["Zipcode"]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Scenario: Build a customer | |
| Given the customer | |
| | First Name | Last Name | Salutation | | |
| | Emilia | Buschmann | Miss | | |
| And the address | |
| | Line 1 | Line 2 | City | State | Zipcode | | |
| | 905 West Dakin Street | Apt. 1 | Chicago | IL | 60613 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Given(@"the customer")] | |
| public void GivenTheCustomerFixed(Table table) | |
| { | |
| _customer = table.CreateInstance<Customer>(); | |
| } | |
| [Given(@"the address")] | |
| public void GivenTheAddress(Table table) | |
| { | |
| _customer.Address = table.CreateInstance<Address>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Scenario: Build a customer | |
| Given the customer | |
| | First Name | Last Name | Salutation | Address | | |
| | Emilia | Buschmann | Miss | 905 West Dakin Street; Apt. 1; Chicago; IL; 60413 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Given(@"the customer")] | |
| public void GivenTheCustomer(Table table) | |
| { | |
| Customer customer = table.CreateInstance<Customer>(); | |
| string[] addressParts = table.Rows[0]["Address"].Split(';'); | |
| Address address = new Address(); | |
| address.Line1 = addressParts[0]; | |
| address.Line2 = addressParts[1]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private Customer _customer; | |
| private Response _response; | |
| [Given(@"the new customer")] | |
| public void GivenTheNewCustomer(Table table) | |
| { | |
| _customer = table.CreateInstance<Customer>(); | |
| } | |
| [Given(@"the customer's address")] |