Exemplo n.º 1
0
        public void When_InputIsNull_MapThrowsException()
        {
            InsertCommand insertCommand = null;

            _target = _fixture.Freeze <InsertCommandHandler>();
            Assert.ThrowsAsync <ArgumentNullException>(async() =>
                                                       await _target.Handle(insertCommand, default(CancellationToken)));
        }
Exemplo n.º 2
0
        public void When_InputIsValid_HandlerContactSuccessfully()
        {
            var expected = _fixture.Create <Guid>();
            var command  = _fixture.Create <InsertCommand>();

            _mockContactsService = _fixture.Freeze <Mock <IContactService> >();
            _mockContactsService.Setup(x => x.CreateContactAsync(It.IsAny <Contact>())).ReturnsAsync(expected);

            _target = _fixture.Create <InsertCommandHandler>();

            var actual = _target.Handle(command, default(CancellationToken));

            Assert.AreEqual(expected, actual.Result);

            _mockContactsService.Verify(x => x.CreateContactAsync(It.IsAny <Contact>()), Times.Once);
        }
Exemplo n.º 3
0
 public void TearDown()
 {
     _mockContactsService = null;
     _fixture             = null;
     _target = null;
 }