Пример #1
0
        public void ShouldAllowToCancel()
        {
            var entity = new Sample(DateTimeOffset.UtcNow, SampleType.Type1, UserId.Generate(), "John Doe");

            entity.Cancel();

            entity.IsDeleted.Should().BeTrue();
            entity.ModifiedAt.Should().NotBeNull();
        }
Пример #2
0
        public void ShouldThrowExceptionWhenAlreadyCancelled()
        {
            var entity = new Sample(DateTimeOffset.UtcNow, SampleType.Type1, UserId.Generate(), "John Doe");

            entity.Cancel();

            entity.Invoking(x => x.Cancel()).Should()
            .Throw <DomainException>()
            .WithMessage("Sample is already cancelled. Entity Sample(key=0).");
        }
 public async Task Add(SampleAddRequest request)
 {
     await Bus.Send(request.ToCommand(UserId.Generate(), string.Empty));
 }
 public async Task <IList <SampleDto> > FindSelf()
 {
     return(await Bus.Send(new FindSamplesQuery(UserId.Generate())));
 }