Esempio n. 1
0
        public Task CanCreate_should_not_throw_exception_if_app_name_is_free()
        {
            var command = new CreateApp {
                Name = "new-app"
            };

            return(GuardApp.CanCreate(command, apps));
        }
Esempio n. 2
0
        public void CanCreate_should_not_throw_exception_if_app_name_is_valid()
        {
            var command = new CreateApp {
                Name = "new-app"
            };

            GuardApp.CanCreate(command);
        }
Esempio n. 3
0
        public Task CanCreate_should_throw_exception_if_name_not_valid()
        {
            var command = new CreateApp {
                Name = "INVALID NAME"
            };

            return(Assert.ThrowsAsync <ValidationException>(() => GuardApp.CanCreate(command, apps)));
        }
Esempio n. 4
0
        public void CanCreate_should_throw_exception_if_name_not_valid()
        {
            var command = new CreateApp {
                Name = "INVALID NAME"
            };

            ValidationAssert.Throws(() => GuardApp.CanCreate(command),
                                    new ValidationError("Name is not a valid slug.", "Name"));
        }
Esempio n. 5
0
        public Task CanCreate_should_throw_exception_if_name_not_valid()
        {
            var command = new CreateApp {
                Name = "INVALID NAME"
            };

            return(ValidationAssert.ThrowsAsync(() => GuardApp.CanCreate(command, apps),
                                                new ValidationError("Name must be a valid slug.", "Name")));
        }
Esempio n. 6
0
        public Task CanCreate_should_throw_exception_if_name_already_in_use()
        {
            var command = new CreateApp {
                Name = "existing"
            };

            return(ValidationAssert.ThrowsAsync(() => GuardApp.CanCreate(command, apps),
                                                new ValidationError("An app with the same name already exists.", "Name")));
        }
Esempio n. 7
0
        public Task CanCreate_should_throw_exception_if_name_already_in_use()
        {
            A.CallTo(() => apps.GetAppAsync("new-app"))
            .Returns(A.Fake <IAppEntity>());

            var command = new CreateApp {
                Name = "new-app"
            };

            return(Assert.ThrowsAsync <ValidationException>(() => GuardApp.CanCreate(command, apps)));
        }