Exemplo n.º 1
0
        public void SetUp()
        {
            var createEmailAccountCommand = new CreateEmailAccount
            {
                SiteId             = Guid.NewGuid(),
                Id                 = Guid.NewGuid(),
                Address            = "*****@*****.**",
                DisplayName        = "My Site",
                Host               = "host",
                Port               = 25,
                UserName           = "******",
                Password           = "******",
                DefaultCredentials = true,
                Ssl                = true
            };
            var createEmailAccountValidatorMock = new Mock <IValidator <CreateEmailAccount> >();

            createEmailAccountValidatorMock.Setup(x => x.Validate(createEmailAccountCommand)).Returns(new ValidationResult());
            _emailAccount = EmailAccount.CreateNew(createEmailAccountCommand, createEmailAccountValidatorMock.Object);

            _command = new DeleteEmailAccount
            {
                SiteId = _emailAccount.SiteId,
                Id     = _emailAccount.Id
            };

            _validatorMock = new Mock <IValidator <DeleteEmailAccount> >();
            _validatorMock.Setup(x => x.Validate(_command)).Returns(new ValidationResult());

            _emailAccount.Delete(_command, _validatorMock.Object);

            _event = _emailAccount.Events.OfType <EmailAccountDeleted>().SingleOrDefault();
        }
Exemplo n.º 2
0
 public void Should_throw_exception_when_already_deleted()
 {
     Assert.Throws <Exception>(() => _emailAccount.Delete(_command, _validatorMock.Object));
 }