示例#1
0
        public async Task ExecutesActionFeatureThrowsException()
        {
            var kernelContainer = new FakeKernelContainer();

            var result =
                await ExecuteFeature.ExecuteAction <ActionFeatureWithException>(kernelContainer, f => f.Execute("Test"));

            Assert.That(result.GetType(), Is.EqualTo(typeof(InternalServerErrorResult)));
        }
示例#2
0
        public async Task ExecutesActionFeature()
        {
            var kernelContainer = new FakeKernelContainer();
            var fakeService     = kernelContainer.Kernel.Get <IFakeService>();

            var result =
                await ExecuteFeature.ExecuteAction <ActionFeature>(kernelContainer, f => f.Execute("Test")) as
                OkObjectResult;

            Assert.That(fakeService.Value, Is.EqualTo("Test"));
            Assert.That(result, Is.Not.Null);
            var resultContent = result.Value;

            Assert.That(resultContent, Is.EqualTo("Bla"));
        }