public ContentPagesDetectionTests()
        {
            _app = new VueTestApp();

            _response = string.Empty;
            try
            {
                // ReSharper disable once ConvertToUsingDeclaration
                using (var client = new RedirectableHttpClient())
                {
                    _response = client.DownloadStringWithSession(_app.BaseUrl + "/app.js");
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, nameof(ContentPagesDetectionTests));
            }
        }
Exemple #2
0
        public void StartJsShouldContainStartUserScript()
        {
            var response = string.Empty;

            try
            {
                // ReSharper disable once ConvertToUsingDeclaration
                using (var client = new RedirectableHttpClient())
                {
                    response = client.DownloadStringWithSession(_app.BaseUrl + "/start.js");
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, nameof(StartJsShouldContainStartUserScript));
            }

            Assert.NotNull(response);
            Assert.Contains("'start_user_InitialLoaded'", response);
        }
Exemple #3
0
        public void IndexShouldContainUserStylesRef()
        {
            var response = string.Empty;

            try
            {
                // ReSharper disable once ConvertToUsingDeclaration
                using (var client = new RedirectableHttpClient())
                {
                    response = client.DownloadStringWithSession(_app.BaseUrl);
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, nameof(IndexShouldContainUserStylesRef));
            }

            Assert.NotNull(response);
            Assert.Contains("'styles/userstyles.css'", response);
        }
        public void DefaultAppShouldContainPagesFromCurrentAssemblyOnly()
        {
            var response = string.Empty;

            try
            {
                // ReSharper disable once ConvertToUsingDeclaration
                using (var client = new RedirectableHttpClient())
                {
                    response = client.DownloadStringWithSession(_app.BaseUrl + "/app.js");
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, nameof(DefaultAppShouldContainPagesFromCurrentAssemblyOnly));
            }

            Assert.NotNull(response);
            Assert.Contains("'start'", response);
            Assert.DoesNotContain("'secondapp'", response);
        }
Exemple #5
0
        public void OnLoadShouldBeCalledForStartVmAfterFirstCall()
        {
            var response = string.Empty;

            try
            {
                // ReSharper disable once ConvertToUsingDeclaration
                using (var client = new RedirectableHttpClient())
                {
                    response = client.DownloadStringWithSession(_app.BaseUrl + "/ViewModel/StartVm");
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, nameof(OnLoadShouldBeCalledForStartVmAfterFirstCall));
            }

            Assert.NotNull(response);
            Assert.Equal(1, _app.Data.StartVmOnLoadCalled);
            Assert.Single(_app.Data.StartVmParameters);
        }
        public void RequestWithParametersShouldSetSessionParameters()
        {
            var response = string.Empty;

            try
            {
                // ReSharper disable once ConvertToUsingDeclaration
                using (var client = new RedirectableHttpClient())
                {
                    response = client.DownloadStringWithSession(_app.BaseUrl + "/ViewModel/StartVm?test=1234");
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, nameof(RequestWithParametersShouldSetSessionParameters));
            }

            Assert.NotNull(response);
            Assert.True(_app.Data.StartVmParameters.ContainsKey("test"));
            Assert.Equal("1234", _app.Data.StartVmParameters["test"]);
        }
Exemple #7
0
        public void RunningMultipleAppsShouldNotMixUpContent()
        {
            var response = string.Empty;

            // app1
            try
            {
                // ReSharper disable once ConvertToUsingDeclaration
                using (var client = new RedirectableHttpClient())
                {
                    response = client.DownloadStringWithSession(_app1.BaseUrl + "/app.js");
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, nameof(RunningMultipleAppsShouldNotMixUpContent));
            }

            Assert.NotNull(response);
            Assert.Contains("'start'", response);
            Assert.DoesNotContain("'secondapp'", response);

            // app2
            try
            {
                // ReSharper disable once ConvertToUsingDeclaration
                using (var client = new RedirectableHttpClient())
                {
                    response = client.DownloadStringWithSession(_app2.BaseUrl + "/app.js");
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, nameof(RunningMultipleAppsShouldNotMixUpContent));
            }

            Assert.NotNull(response);
            Assert.Contains("'secondapp'", response);
            Assert.DoesNotContain("'start'", response);
        }
Exemple #8
0
        public void AppWithPrivateIndexShouldGetPrivateIndex()
        {
            var response = string.Empty;

            // app2 - with private index.html
            try
            {
                // ReSharper disable once ConvertToUsingDeclaration
                using (var client = new RedirectableHttpClient())
                {
                    response = client.DownloadStringWithSession(_app2.BaseUrl);
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, nameof(AppWithPrivateIndexShouldGetPrivateIndex));
            }

            Assert.NotNull(response);
            Assert.Contains("<!--IctBaden.Stonehenge3.Vue.TestApp2.index.html-->", response);
            Assert.DoesNotContain("<!--IctBaden.Stonehenge3.Vue.index.html-->", response);
        }
        public void ModifyNotifyPropertyShouldCreateEvent()
        {
            var response = string.Empty;

            try
            {
                // ReSharper disable once ConvertToUsingDeclaration
                using (var client = new RedirectableHttpClient())
                {
                    response = client.DownloadStringWithSession(_app.BaseUrl + "/ViewModel/StartVm");
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, nameof(ModifyNotifyPropertyShouldCreateEvent));
            }

            Assert.NotNull(response);


            _app.Data.ExecAction("Notify");

            // rising event not yet tested ...
        }