Skip to content

Instantly share code, notes, and snippets.

@seif
Created February 10, 2012 18:35
Show Gist options
  • Save seif/1791519 to your computer and use it in GitHub Desktop.
Save seif/1791519 to your computer and use it in GitHub Desktop.
sharp arch validator and entity with typed id
[HasUniqueDomainSignatureWithGuidId]
public class Song : EntityWithTypedId<Guid>
{
public Song()
{
}
[DomainSignature]
public virtual string SongTitle { get; set; }
[DomainSignature]
public virtual Band Performer { get; set; }
}
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