Пример #1
0
        public async Task Toggle_missing_payee_fails()
        {
            var payeeId = 42;
            var command = new TogglePayeeIsActiveCommand(payeeId: payeeId);

            payees.GetById(Arg.Is(payeeId))
            .Returns(Enumerable.Empty <Payee>().AsAsyncQueryable());

            var result = await handler.Handle(command);

            Assert.IsInstanceOfType(result, typeof(FailureResult));
        }
Пример #2
0
        public async Task Can_toggle_payee_inactive()
        {
            var payeeId = 42;
            var payee   = new Payee {
                Id = payeeId, IsActive = false
            };
            var command = new TogglePayeeIsActiveCommand(payeeId: payeeId);

            payees.GetById(Arg.Is(payeeId))
            .Returns(new[] { payee }.AsAsyncQueryable());

            var result = await handler.Handle(command);

            Assert.IsInstanceOfType(result, typeof(SuccessResult));
            Assert.IsTrue(payee.IsActive);
        }