Esempio n. 1
0
        public async Task AcceptComandShouldThrowIfTestNotFound()
        {
            var command = new AcceptTestCommand
            {
                Accepted = true,
                Guid     = "SomeRandom"
            };

            var commandHandler = new AcceptTestCommandHandler(_context);
            await commandHandler.Handle(command, CancellationToken.None).ShouldThrowAsync <EntityNotFoundException>();
        }
Esempio n. 2
0
        public async Task AcceptCommandShouldChangeTestStatusCodeToAccepted()
        {
            var test    = _context.Tests.Find(1);
            var command = new AcceptTestCommand
            {
                Accepted = true,
                Guid     = test.ActivationUrl
            };

            var commandHandler = new AcceptTestCommandHandler(_context);
            await commandHandler.Handle(command, CancellationToken.None);

            var acceptedTest = _context.Tests.Find(1);

            acceptedTest.ShouldNotBeNull();
            acceptedTest.ActivationStatusCode.ShouldBe(ActivationStatusCode.Accepted);
        }