Browse Source

Some more tests

pull/1/head
Sebastian 9 years ago
parent
commit
3650ff1829
  1. 2
      src/PinkParrot.Write/Schemas/SchemaDomainObject.cs
  2. 25
      tests/PinkParrot.Write.Tests/Schemas/SchemaDomainObjectTest.cs

2
src/PinkParrot.Write/Schemas/SchemaDomainObject.cs

@ -100,7 +100,7 @@ namespace PinkParrot.Write.Schemas
public void On(SchemaDeleted @event) public void On(SchemaDeleted @event)
{ {
isDeleted = false; isDeleted = true;
} }
public void AddField(AddField command, FieldProperties properties) public void AddField(AddField command, FieldProperties properties)

25
tests/PinkParrot.Write.Tests/Schemas/SchemaDomainObjectTest.cs

@ -102,5 +102,30 @@ namespace PinkParrot.Write.Tests.Schemas
.ShouldBeEquivalentTo( .ShouldBeEquivalentTo(
new SchemaUpdated { Properties = props }); new SchemaUpdated { Properties = props });
} }
[Fact]
public void Delete_should_throw_if_not_created()
{
Assert.Throws<DomainException>(() => sut.Delete());
}
[Fact]
public void Delete_should_throw_if_already_deleted()
{
sut.Create(new CreateSchema { Name = TestName });
sut.Delete();
Assert.Throws<DomainException>(() => sut.Delete());
}
[Fact]
public void Delete_should_refresh_properties()
{
sut.Create(new CreateSchema { Name = TestName, AppId = appId });
sut.Delete();
Assert.True(sut.IsDeleted);
Assert.IsType<SchemaDeleted>(sut.GetUncomittedEvents().Last().Payload);
}
} }
} }

Loading…
Cancel
Save