コード例 #1
0
        public void Should_have_validation_error_when_site_id_is_empty()
        {
            var command = new RemoveMenuItem
            {
                SiteId = Guid.Empty
            };

            var siteRulesMock = new Mock <ISiteRules>();
            var validator     = new RemoveMenuItemValidator(siteRulesMock.Object);

            validator.ShouldHaveValidationErrorFor(x => x.SiteId, command);
        }
コード例 #2
0
        public void Should_have_validation_error_when_site_does_not_exist()
        {
            var command = new RemoveMenuItem
            {
                SiteId = Guid.NewGuid()
            };

            var siteRulesMock = new Mock <ISiteRules>();

            siteRulesMock.Setup(x => x.DoesSiteExist(command.SiteId)).Returns(false);

            var validator = new RemoveMenuItemValidator(siteRulesMock.Object);

            validator.ShouldHaveValidationErrorFor(x => x.SiteId, command);
        }