public void GivenAContextTheAnInstanceIsReturnedWithTheContextSet() { var context = new SerializableMessage(); var instance = new AggregateDoesNotExistException <AggregateRoot>(context); Assert.Equal(context, instance.Context); }
public void GivenAnInstanceThenAllPropertiesAreSerialized() { var context = new SerializableMessage(); var original = new AggregateDoesNotExistException <AggregateRoot>(context); AggregateDoesNotExistException <AggregateRoot> deserialized = original.Clone(); Assert.NotSame(original, deserialized); Assert.Equal(original.Context, deserialized.Context); }
public async Task GivenAnEmptyReferenceThenAnAggregateDoesNotExistExceptionIsThrownAsync() { Reference reference = Reference <SerializableAggregateRoot> .Empty; AggregateDoesNotExistException <SerializableAggregateRoot> exception = await Assert.ThrowsAsync <AggregateDoesNotExistException <SerializableAggregateRoot> >( () => reference.RetrieveAsync(context, repository.Object)); repository.Verify( repo => repo.GetAsync( It.IsAny <Guid>(), It.IsAny <CancellationToken?>(), It.IsAny <SignedVersion>()), Times.Never); Assert.Equal(context, exception.Context); }