public async Task Create_should_create_domain_object() { var command = new CreateAsset { AssetId = assetId, File = file }; var context = CreateContextForCommand(command); A.CallTo(() => tagGenerator.GenerateTags(command, A <HashSet <string> > .Ignored)) .Invokes(new Action <CreateAsset, HashSet <string> >((c, tags) => { tags.Add("tag1"); tags.Add("tag2"); })); SetupStore(0, context.ContextId); SetupImageInfo(); await sut.HandleAsync(context); var result = context.Result <AssetCreatedResult>(); Assert.Equal(assetId, result.Id); Assert.Contains("tag1", result.Tags); Assert.Contains("tag2", result.Tags); AssertAssetHasBeenUploaded(0, context.ContextId); AssertAssetImageChecked(); }
public async Task Create_should_create_domain_object() { var context = CreateContextForCommand(new CreateAsset { AssetId = assetId, File = file }); SetupStore(0, context.ContextId); SetupImageInfo(); await sut.HandleAsync(context); Assert.Equal(assetId, context.Result <EntityCreatedResult <Guid> >().IdOrValue); AssertAssetHasBeenUploaded(0, context.ContextId); AssertAssetImageChecked(); }
public async Task Create_should_create_domain_object() { var command = new CreateAsset { AssetId = assetId, File = file }; var context = CreateContextForCommand(command); SetupTags(command); SetupImageInfo(); await sut.HandleAsync(context); var result = context.Result <AssetCreatedResult>(); Assert.Equal(assetId, result.IdOrValue); Assert.Contains("tag1", result.Tags); Assert.Contains("tag2", result.Tags); AssertAssetHasBeenUploaded(0, context.ContextId); AssertAssetImageChecked(); }
public async Task Should_not_invoke_enricher_for_other_result() { var command = CreateCommand(new MyCommand()); var context = CreateContextForCommand(command); context.Complete(12); await sut.HandleAsync(context); A.CallTo(() => assetEnricher.EnrichAsync(A <IEnrichedAssetEntity> .Ignored, requestContext)) .MustNotHaveHappened(); }