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
| def "Cap and Iron Man Beat Thanos"() { | |
| given: | |
| createTeam('Avengers') | |
| addAvenger('Captain America') | |
| addAvenger('Iron Man') | |
| badGuyArrives('Thanos') | |
| when: | |
| fight() |
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 void UpdateStreet(string newStreet) { | |
| if(string.IsNullOrEmpty(newStreet) && | |
| !newStreet.StartsWith(" ") && | |
| !newStreet.StartsWith("@")) { | |
| Address address = new Address(this); | |
| address.SetStreet(newStreet); | |
| } | |
| } | |
| } |
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 void UpdateStreet(string newStreet) | |
| { | |
| if (ValidateStreet(newStreet)) | |
| { | |
| Address address = new Address(this); | |
| address.SetStreet(newStreet); | |
| } | |
| } | |
| private bool ValidateStreet(string street) |
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 void UpdateStreet(string newStreet) { | |
| if (StreetValidator.Validate(newStreet)) { | |
| Address address = new Address(this); | |
| address.SetStreet(newStreet); | |
| } | |
| } |
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 void UpdateStreet(string otherStreet) { | |
| if(string.IsNullOrEmpty(otherStreet) && | |
| !otherStreet.StartsWith(" ") && | |
| !otherStreet.StartsWith("@")) && | |
| currentAddress.GetStreet().CompareTo(otherStreet) == 0) { | |
| Address address = new Address(this); | |
| address.SetStreet(otherStreet); | |
| } | |
| } | |
| } |
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 bool ValidateStreet(string street) { | |
| return string.IsNullOrEmpty(street) && | |
| !street.StartsWith(" ") && | |
| !street.StartsWith("@") && | |
| currentAddress.GetStreet().CompareTo(street) == 0; | |
| } |
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 bool ValidateStreet(string street, Address currentAddress) | |
| { | |
| return string.IsNullOrEmpty(street) && | |
| !street.StartsWith(" ") && | |
| !street.StartsWith("@") && | |
| currentAddress.GetStreet().CompareTo(street) == 0; | |
| } |