Ejemplo n.º 1
0
        public void Test_SaveContact_Enqueues_Email()
        {
            var request = new SaveContact
            {
                Id          = 1,
                FirstName   = "First",
                LastName    = "Last",
                Email       = "*****@*****.**",
                PhoneNumber = "555-1212",
            };

            var queue   = A.Fake <IQueueService>();
            var handler = new SaveContact.Handler(_db, _appContext, queue, _mediator);

            handler.Handle(request);

            A.CallTo(() => queue.Enqueue(A <SendEmail> ._, _appContext)).MustHaveHappened(Repeated.Exactly.Once);
        }
Ejemplo n.º 2
0
        public void Test_SaveContact_Publishes_Alert()
        {
            var request = new SaveContact
            {
                Id          = 1,
                FirstName   = "First",
                LastName    = "Last",
                Email       = "*****@*****.**",
                PhoneNumber = "555-1212",
            };

            var mediator = A.Fake <IMediator>();
            var handler  = new SaveContact.Handler(_db, _appContext, _queue, mediator);

            handler.Handle(request);

            A.CallTo(() => mediator.Publish(A <Alert> ._)).MustHaveHappened(Repeated.Exactly.Once);
        }
Ejemplo n.º 3
0
        public TestSaveContact()
        {
            var contacts = new[]
            {
                new Contact
                {
                    Id = 1,
                    FirstName = "First",
                    LastName = "Last",
                    Email = "*****@*****.**",
                    PhoneNumber = "555-1212"
                },
            }.ToDbSet();

            _db = A.Fake<ContactDb>();
            A.CallTo(() => _db.Contacts).Returns(contacts);

            _appContext = A.Fake<AppContext>();
            _queue = A.Fake<IQueueService>();
            _mediator = A.Fake<IMediator>();

            _handler = new SaveContact.Handler(_db, _appContext, _queue, _mediator);
        }
Ejemplo n.º 4
0
        public TestSaveContact()
        {
            var contacts = new[]
            {
                new Contact
                {
                    Id          = 1,
                    FirstName   = "First",
                    LastName    = "Last",
                    Email       = "*****@*****.**",
                    PhoneNumber = "555-1212"
                },
            }.ToDbSet();

            _db = A.Fake <ContactDb>();
            A.CallTo(() => _db.Contacts).Returns(contacts);

            _appContext = A.Fake <AppContext>();
            _queue      = A.Fake <IQueueService>();
            _mediator   = A.Fake <IMediator>();

            _handler = new SaveContact.Handler(_db, _appContext, _queue, _mediator);
        }
Ejemplo n.º 5
0
        public void Test_SaveContact_Publishes_Alert()
        {
            var request = new SaveContact
            {
                Id = 1,
                FirstName = "First",
                LastName = "Last",
                Email = "*****@*****.**",
                PhoneNumber = "555-1212",
            };

            var mediator = A.Fake<IMediator>();
            var handler = new SaveContact.Handler(_db, _appContext, _queue, mediator);
            handler.Handle(request);

            A.CallTo(() => mediator.Publish(A<Alert>._)).MustHaveHappened(Repeated.Exactly.Once);
        }
Ejemplo n.º 6
0
        public void Test_SaveContact_Enqueues_Email()
        {
            var request = new SaveContact
            {
                Id = 1,
                FirstName = "First",
                LastName = "Last",
                Email = "*****@*****.**",
                PhoneNumber = "555-1212",
            };

            var queue = A.Fake<IQueueService>();
            var handler = new SaveContact.Handler(_db, _appContext, queue, _mediator);
            handler.Handle(request);

            A.CallTo(() => queue.Enqueue(A<SendEmail>._, _appContext)).MustHaveHappened(Repeated.Exactly.Once);
        }