Created
February 10, 2012 18:35
-
-
Save seif/1791519 to your computer and use it in GitHub Desktop.
sharp arch validator and entity with typed id
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
[HasUniqueDomainSignatureWithGuidId] | |
public class Song : EntityWithTypedId<Guid> | |
{ | |
public Song() | |
{ | |
} | |
[DomainSignature] | |
public virtual string SongTitle { get; set; } | |
[DomainSignature] | |
public virtual Band Performer { get; set; } | |
} |
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
public class when_validating_a_duplicate_entity_that_has_a_null_value_domain_signature_property : specification_for_has_unique_domain_signature_validator | |
{ | |
static Song duplicateSong; | |
static bool result; | |
private Establish context = () => | |
{ | |
var song = new Song() { SongTitle = "Souvenirs" }; | |
NHibernateSession.Current.Save(song); | |
NHibernateSession.Current.Flush(); | |
duplicateSong = new Song() { SongTitle = "Souvenirs" }; | |
}; | |
Because of = () => result = duplicateSong.IsValid(); | |
It should_say_the_entity_is_invalid = () => result.ShouldBeFalse(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment