Example #1
0
        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(() => contentEnricher.EnrichAsync(A <IEnrichedContentEntity> .Ignored, User))
            .MustNotHaveHappened();
        }
Example #2
0
        public async Task Create_should_throw_exception_if_data_is_not_valid()
        {
            A.CallTo(() => scriptEngine.ExecuteAndTransform(A <ScriptContext> .Ignored, A <string> .Ignored))
            .Returns(invalidData);

            var context = CreateContextForCommand(new CreateContent {
                ContentId = contentId, Data = invalidData, User = user
            });

            await TestCreate(content, async _ =>
            {
                await Assert.ThrowsAsync <ValidationException>(() => sut.HandleAsync(context));
            }, false);
        }