Ejemplo n.º 1
0
        public async Task AddPaymentMethod_UserSignedIn_SetsActivePaymentMethodForUser()
        {
            //Arrange
            var fakeMediator = Substitute.For <IMediator>();

            var mapper = AutoMapperFactory.CreateValidMapper();

            var controller = new PaymentController(
                fakeMediator,
                mapper);

            controller.FakeAuthentication("some-identity-name");

            //Act
            await controller.AddPaymentMethod("some-payment-method-id");

            //Assert
            await fakeMediator
            .Received(1)
            .Send(Arg.Is <SetActivePaymentMethodForUserCommand>(arg =>
                                                                arg.PaymentMethodId == "some-payment-method-id"));
        }