Beispiel #1
0
        public void Test_ValidateNameSpace()
        {
            var generator = new MockControllerGenerator(
                _libraryManager.Object,
                _applicationInfo,
                _codeGenActionService.Object,
                _serviceProvider.Object,
                _logger
                );

            var model = GetModel();

            model.ControllerNamespace = "Valid.Namespace";
            try
            {
                generator.Generate(model);
            }
            catch
            {
                Assert.True(false);
                return;
            }
        }
Beispiel #2
0
        public void Test_ValidateNameSpace_ThrowsException()
        {
            var generator = new MockControllerGenerator(
                _libraryManager.Object,
                _applicationInfo,
                _codeGenActionService.Object,
                _serviceProvider.Object,
                _logger
                );

            var model = GetModel();

            model.ControllerNamespace = "Invalid Namespace";
            try
            {
                generator.Generate(model);
                Assert.True(false, "Expected an exception");
            }
            catch (InvalidOperationException ex)
            {
                Assert.Equal("The namespace name 'Invalid Namespace' is not valid.", ex.Message);
                return;
            }
        }