Esempio n. 1
0
        public async Task WhenHandlingDonorRegistered_ThenNoOp()
        {
            var repo    = new TestEntityRepository <TaxStatusValidation>();
            var handler = new TaxStatusValidationHandler(
                Mock.Of <ITaxIdRecognizer>(),
                new Mock <IPersonRepository>(MockBehavior.Strict).Object,
                repo);

            await handler.HandleAsync(Constants.Donor.Create().Events.OfType <PersonRegistered>().First());
        }
Esempio n. 2
0
        public async Task WhenHandlingDoneeRegistered_ThenCreatesValidation()
        {
            var donee   = Constants.Donee.Create();
            var repo    = new TestEntityRepository <TaxStatusValidation>();
            var handler = new TaxStatusValidationHandler(
                Mock.Of <ITaxIdRecognizer>(),
                Mock.Of <IPersonRepository>(x =>
                                            x.GetAsync <Donee>(donee.PersonId, false) == Task.FromResult(donee)),
                repo);

            await handler.HandleAsync(Constants.Donee.Create().Events.OfType <PersonRegistered>().First());

            Assert.NotNull(await repo.GetAsync(Constants.Donee.Id));
        }