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: Make "I" optional | |
Given the following devices | |
| Product Name | | |
| Galaxy IV | | |
| iPhone | | |
| Windows Phone | | |
| Note | | |
| Kindle | | |
| Blackberry Storm | | |
| iPad | |
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
[When(@"(?:I\s)?remove the (\d+)(?:st|nd|rd|th) item")] | |
public void WhenIRemoveTheItem(int index) | |
{ | |
_products.RemoveAt(--index); | |
} |
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
using System; | |
using System.Collections.Generic; | |
using System.Data.SqlClient; | |
using System.IO; | |
using System.Text; | |
namespace TruncateData | |
{ | |
public class Program | |
{ |
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
@echo off | |
:: Save the current directory to the directory stack and | |
:: change the current directory to the one in which the current batch file is located. | |
pushd %~dp0 | |
echo %CD% | |
:: Restore the previous current directory. | |
popd | |
echo %CD% |
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()) | |
{ | |
// There's no need to explicitly hide the form | |
// because the button's DialogResult property | |
// has a value of DialogResult.OK | |
// Details elided... | |
} |
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
using (var form = new SelectUserForm()) | |
{ | |
// Set form properties... | |
if (form.ShowDialog(this) == DialogResult.OK) | |
{ | |
// Process results... | |
} | |
} |
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
protected override void OnLoad(EventArgs e) | |
{ | |
// Details elided | |
base.OnLoad(e); | |
} |
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
protected override bool ProcessDialogKey(Keys keyData) | |
{ | |
// Suppress the accept button when the filter editor has the focus. | |
// This doesn't work in the KeyDown or KeyPress events. | |
if((keyData == Keys.Return) && (filterEditor.ContainsFocus)) | |
return true; | |
return base.ProcessDialogKey(keyData); | |
} |
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
protected override bool ProcessDialogKey(Keys keyData) | |
{ | |
// Suppress the accept button by preventing the parent form | |
// from processing the return key. | |
// Return false to indicate that the key press has not been | |
// handled and the child control should handle it. | |
if (keyData == Keys.Return) | |
return false; | |
return base.ProcessDialogKey(keyData); |
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) | |
{ | |
using (var form = new SelectUserForm()) | |
{ | |
form.SelectedUsers = SelectedUsers; | |
if (form.ShowDialog(this) == DialogResult.OK) | |
{ | |
SelectedUsers = form.SelectedUsers; | |
lblUsers.Text = SelectedUsers.Values.ToDelimitedString(", "); |