Пример #1
0
        public void URL_WithValidRequest_ReturnsURL()
        {
            Request   request = RequestCreate();
            URLDecode TestUrl = new URLDecode(url);

            Assert.AreEqual(TestUrl.RawUrl, request.Url.RawUrl);
        }
Пример #2
0
        public void RawUrl_WithValidURL_ReturnsURL()
        {
            //Arrange
            URLDecode urlDecode = new URLDecode(testUrl);

            //Act & Assert
            Assert.AreEqual(testUrl, urlDecode.RawUrl, null, "RawUrl gibt nicht richtigen Wert zurück.");
        }
Пример #3
0
        public void ParameterCount_WithValidURL_ReturnsParameterCount()
        {
            //Arrange
            int       testParameterCount = 2;
            URLDecode urlDecode          = new URLDecode(testUrl);

            //Act & Assert
            Assert.AreEqual(testParameterCount, urlDecode.ParameterCount, null, "ParameterCount gibt nicht richtigen Wert zurück.");
        }
Пример #4
0
        public void Path_WithValidURL_ReturnsPath()
        {
            //Arrange
            string    testPath  = "https://google.at/site1/index.php";
            URLDecode urlDecode = new URLDecode(testUrl);

            //Act & Assert
            Assert.AreEqual(testPath, urlDecode.Path, null, "Path gibt nicht richtigen Wert zurück.");
        }
Пример #5
0
        public void Fragment_WithValidURL_ReturnsFragment()
        {
            //Arrange
            string    testFragment = "information";
            URLDecode urlDecode    = new URLDecode(testUrl);

            //Act & Assert
            Assert.AreEqual(testFragment, urlDecode.Fragment, null, "Fragment gibt nicht richtigen Wert zurück.");
        }
Пример #6
0
        public void Extension_WithValidURL_ReturnsExtension()
        {
            //Arrange
            string    testExtension = ".php";
            URLDecode urlDecode     = new URLDecode(testUrl);

            //Act & Assert
            Assert.AreEqual(testExtension, urlDecode.Extension, null, "Extension gibt nicht richtigen Wert zurück.");
        }
Пример #7
0
        public void FileName_WithValidURL_ReturnsFileName()
        {
            //Arrange
            string    testFileName = "index.php";
            URLDecode urlDecode    = new URLDecode(testUrl);

            //Act & Assert
            Assert.AreEqual(testFileName, urlDecode.FileName, null, "FileName gibt nicht richtigen Wert zurück.");
        }
Пример #8
0
        public void ParameterCount_WithNoParameter_ReturnsParameterCount()
        {
            //Arrange
            string    testUrlNoParameter = "https://google.at/site1/index.php";
            int       testParameterCount = 0;
            URLDecode urlDecode          = new URLDecode(testUrlNoParameter);

            //Act & Assert
            Assert.AreEqual(testParameterCount, urlDecode.ParameterCount, null, "ParameterCount gibt nicht richtigen Wert zurück.");
        }
Пример #9
0
        public void Parameter_WithNoParameter_ReturnsEmptyDic()
        {
            //Arrange
            string testUrlNoParameter = "https://google.at/site1/index.php";
            Dictionary <string, string> testParameter = new Dictionary <string, string>();
            URLDecode urlDecode = new URLDecode(testUrlNoParameter);

            //Act & Assert
            Assert.AreEqual(testParameter, urlDecode.Parameter, null, "Parameter gibt nicht richtigen Wert zurück.");
        }
Пример #10
0
        public void Fragment_WithNoFragment_ReturnsEmptyString()
        {
            //Arrange
            string    testUrlNoFragment = "https://google.at/site1/index?id=100";
            string    testFragment      = "";
            URLDecode urlDecode         = new URLDecode(testUrlNoFragment);

            //Act & Assert
            Assert.AreEqual(testFragment, urlDecode.Fragment, null, "Fragment gibt nicht richtigen Wert zurück.");
        }
Пример #11
0
        public void FileName_WithNoFileName_ReturnsEmptyString()
        {
            //Arrange
            string    testUrlNoFileName = "https://google.at/site1/index?id=100";
            string    testFileName      = "";
            URLDecode urlDecode         = new URLDecode(testUrlNoFileName);

            //Act & Assert
            Assert.AreEqual(testFileName, urlDecode.FileName, null, "FileName gibt nicht richtigen Wert zurück.");
        }
Пример #12
0
        public void Segments_WithValidURL_ReturnsSegments()
        {
            //Arrange
            string[]  testSegments = new string[] { "site1", "index.php" };
            URLDecode urlDecode    = new URLDecode(testUrl);

            //Convert testSegments into string to simplify Assert
            string testSegmentsString = string.Join(";", testSegments);

            //Act & Convert
            string resultSegmentsString = string.Join(";", urlDecode.Segments);

            //Assert
            Assert.AreEqual(testSegmentsString, resultSegmentsString, null, "Segments gibt nicht richtigen Wert zurück.");
        }
Пример #13
0
        public void Parameter_WithValidURL_ReturnsParameter()
        {
            //Arrange
            Dictionary <string, string> testParameter = new Dictionary <string, string>();

            testParameter.Add("id", "1");
            testParameter.Add("price", "100");
            URLDecode urlDecode = new URLDecode(testUrl);
            //Convert Dictionary to string to simplify assert
            string testParameterString = string.Join(";", testParameter.Select(x => x.Key + "=" + x.Value).ToArray());

            //Act & Convert
            string resultParameterString = string.Join(";", urlDecode.Parameter.Select(x => x.Key + "=" + x.Value).ToArray());

            //Assert
            Assert.AreEqual(testParameterString, resultParameterString, "Parameter gibt nicht richtigen Wert zurück.");
        }
Пример #14
0
        public void Segments_WithNoSegments_ReturnsEmptyArray()
        {
            //Arrange
            string testUrlNoSegments = "https://google.at";

            string[]  testSegments = new string[0];
            URLDecode urlDecode    = new URLDecode(testUrlNoSegments);

            //Convert testSegments into string to simplify Assert
            string testSegmentsString = testSegments.ToString();

            //Act & Convert
            string resultSegmentsString = urlDecode.Segments.ToString();

            //Assert
            Assert.AreEqual(testSegmentsString, resultSegmentsString, null, "Segments gibt nicht richtigen Wert zurück.");
        }