Esempio n. 1
0
        public void HttpErrorCollectionContainsTest()
        {
            var one = new HTTPError(402, DateTime.Now);

            var collection = new HTTPErrorsCollection();

            collection.Add(one);
            Assert.IsTrue(collection.HttpErrors.Contains(one));
        }
Esempio n. 2
0
        public void HttpErrorCollectionClearTest()
        {
            var one   = new HTTPError(402, DateTime.Now);
            var two   = new HTTPError(403, DateTime.Now);
            var three = new HTTPError(404, DateTime.Now);

            var collection = new HTTPErrorsCollection();

            collection.Add(one);
            collection.Add(two);
            collection.Add(three);
            collection.Clear();
            Assert.IsTrue(collection.HttpErrors.Count == 0);
        }
Esempio n. 3
0
        public void HttpErrorsGetterTest()
        {
            var one   = new HTTPError(402, DateTime.Now);
            var two   = new HTTPError(403, DateTime.Now);
            var three = new HTTPError(404, DateTime.Now);

            var collection = new HTTPErrorsCollection();

            collection.Add(one);
            collection.Add(two);
            collection.Add(three);

            Assert.IsTrue(collection.HttpErrors.Count > 0);
            Assert.IsTrue(collection[0].Code == 402);
        }
Esempio n. 4
0
        public void ReadLogOfErrorsFromFileTest()
        {
            HTTPErrorsCollection httpErrorsCollection = new HTTPErrorsCollection();

            try
            {
                httpErrorsCollection.ReadLogOfErrorsFromFile("File54.txt");
            }
            catch (FileNotFoundException e)
            {
                Assert.AreEqual(e.Message, "There is no such file.");
                return;
            }
            Assert.Fail("No exception was thrown.");
        }