public void LanguageIsCreatedWithTrueValidation()
        {
            var command = new CreateLanguageCommand(trueValidator, repo);

            var currentCount = context.Collection <LanguageEntity>().AsQueryable().ToList().Count;

            command.Execute(request);

            var countAfterCreation = context.Collection <LanguageEntity>().AsQueryable().ToList().Count;

            Assert.IsTrue(countAfterCreation == currentCount + 1);
        }
        public void LanguageIsNotCreatedWhenValidatorReturnsFalse()
        {
            var command = new CreateLanguageCommand(falseValidator, repo);

            var currentCount = context.Collection <LanguageEntity>().AsQueryable().ToList().Count;

            Assert.Throws <ArgumentException>(() => command.Execute(request));

            var countAfterCreation = context.Collection <LanguageEntity>().AsQueryable().ToList().Count;

            Assert.IsTrue(countAfterCreation == currentCount);
        }
Ejemplo n.º 3
0
 public void Post(CreateLanguageRequest request)
 {
     createLanguageCommand.Execute(request);
 }