-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extend tests on appending.
- Loading branch information
Showing
11 changed files
with
775 additions
and
517 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
#if NET8_0_OR_GREATER | ||
#else | ||
namespace Email_address_collection_specs; | ||
//#if NET8_0_OR_GREATER | ||
//#else | ||
//namespace Email_address_collection_specs; | ||
|
||
public class Supports_binary_serialization | ||
{ | ||
[Test] | ||
[Obsolete("Usage of the binary formatter is considered harmful.")] | ||
public void using_BinaryFormatter() | ||
{ | ||
var round_tripped = SerializeDeserialize.Binary(Svo.EmailAddressCollection); | ||
round_tripped.Should().BeEquivalentTo(Svo.EmailAddressCollection); | ||
} | ||
[Test] | ||
public void storing_string_in_SerializationInfo() | ||
{ | ||
var info = Serialize.GetInfo(Svo.EmailAddressCollection); | ||
info.GetString("Value").Should().Be("info@qowaiv.org,test@qowaiv.org"); | ||
} | ||
} | ||
#endif | ||
//public class Supports_binary_serialization | ||
//{ | ||
// [Test] | ||
// [Obsolete("Usage of the binary formatter is considered harmful.")] | ||
// public void using_BinaryFormatter() | ||
// { | ||
// var round_tripped = SerializeDeserialize.Binary(Svo.EmailAddressCollection); | ||
// round_tripped.Should().BeEquivalentTo(Svo.EmailAddressCollection); | ||
// } | ||
// [Test] | ||
// public void storing_string_in_SerializationInfo() | ||
// { | ||
// var info = Serialize.GetInfo(Svo.EmailAddressCollection); | ||
// info.GetString("Value").Should().Be("info@qowaiv.org,test@qowaiv.org"); | ||
// } | ||
//} | ||
//#endif |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
namespace Email_address_set_specs; | ||
|
||
public class Appends | ||
{ | ||
[Test] | ||
public void new_email_address_in_ascending_order([Range(0, 25)] int index) | ||
{ | ||
var emails = Enumerable.Range(0, 26).Select(i => EmailAddress.Parse($"{(char)('A' + i)}@qowaiv.org")).ToArray(); | ||
var collection = EmailAddressCollection.New(emails); | ||
|
||
IReadOnlyCollection<EmailAddress> appended = collection.Append(EmailAddress.Parse($"{emails[index]}.com")); | ||
|
||
appended.Should().HaveCount(collection.Count + 1); | ||
appended.Should().BeInAscendingOrder(); | ||
} | ||
|
||
[Test] | ||
public void existing_email_address_changes_nothing([Range(0, 25)] int index) | ||
{ | ||
var emails = Enumerable.Range(0, 26).Select(i => EmailAddress.Parse($"{(char)('A' + i)}@qowaiv.org")).ToArray(); | ||
var collection = EmailAddressCollection.New(emails); | ||
|
||
object appended = collection.Append(emails[index]); | ||
appended.Should().Be(collection); | ||
} | ||
|
||
[TestCase("")] | ||
[TestCase("?")] | ||
public void changes_nothing_for_empty_or_unknown(EmailAddress notKnown) | ||
{ | ||
object appended = Svo.EmailAddressCollection.Append(notKnown); | ||
appended.Should().Be(Svo.EmailAddressCollection); | ||
} | ||
} |
This file contains 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
Oops, something went wrong.