Beispiel #1
0
        public void GetAreaByIdTest()
        {
            MysqlSource target = new MysqlSource(CONNECTION_STRING);
            int         areaId = 6;
            Area        actual;

            actual = target.GetAreaById(areaId);
            Assert.IsNotNull(actual);
        }
Beispiel #2
0
        public void RegionsTest()
        {
            MysqlSource          target = new MysqlSource(CONNECTION_STRING);
            IEnumerable <Region> actual;

            actual = target.Regions();
            Assert.IsNotNull(actual);
            Assert.IsTrue(actual.Count() > 0);
        }
Beispiel #3
0
        public void GetAreasByRegionIdTest()
        {
            MysqlSource        target = new MysqlSource(CONNECTION_STRING);
            int                id     = 3;
            IEnumerable <Area> actual;

            actual = target.GetAreasByRegionId(id);
            Assert.IsNotNull(actual);
            Assert.IsTrue(actual.Count() > 0);
        }
Beispiel #4
0
        public void GetRegionByIdTest()
        {
            MysqlSource target = new MysqlSource(CONNECTION_STRING);
            int         id     = 2;
            Region      actual;

            actual = target.GetRegionById(id);
            Assert.IsFalse(String.IsNullOrEmpty(actual.RegionName), "Location Name is Empty");
            Assert.AreEqual(actual.RegionId, id, "Region Id is not assigned");
        }
Beispiel #5
0
        public void GetLocationsByAreaIdTest()
        {
            MysqlSource            target = new MysqlSource(CONNECTION_STRING);
            int                    areaId = 5;
            IEnumerable <Location> actual;

            actual = target.GetLocationsByAreaId(areaId);
            Assert.IsNotNull(actual);
            Assert.IsTrue(actual.Count() > 0);
        }
Beispiel #6
0
        public void GetEntriesByLocationIdTest()
        {
            MysqlSource         target     = new MysqlSource(CONNECTION_STRING);
            int                 locationId = 2;
            IEnumerable <Entry> actual;

            actual = target.GetEntriesByLocationId(locationId);
            Assert.IsNotNull(actual);
            Assert.IsTrue(actual.Count() > 0);
        }
Beispiel #7
0
        public void GetEntryByIdTest()
        {
            MysqlSource target  = new MysqlSource(CONNECTION_STRING);
            int         entryId = 1;
            Entry       actual;

            actual = target.GetEntryById(entryId);
            Assert.IsNotNull(actual);
            Assert.IsFalse(String.IsNullOrEmpty(actual.Clue), "Clue has no value");
            Assert.IsFalse(String.IsNullOrEmpty(actual.Hint), "Hint has no value");
        }
Beispiel #8
0
        public void GetLocationByIdTest()
        {
            MysqlSource target     = new MysqlSource(CONNECTION_STRING);
            int         locationId = 1;
            Location    actual;

            actual = target.GetLocationById(locationId);
            Assert.IsNotNull(actual);
            Assert.IsFalse(String.IsNullOrEmpty(actual.LocationName), "Location Name is Empty");
            Assert.AreNotEqual(actual.AreaId, 0, "Area Id is not assigned");
            Assert.AreEqual(actual.LocationId, locationId, "Location Id is incorrect");
        }
Beispiel #9
0
    public static void Error(string message, string callstack, HttpContext context)
    {
        MySqlConnection c = new MySqlConnection();

        c.ConnectionString = Util.GetByName(Engine.GetConfig(), "mysql").Attributes["connectionString"].Value;
        c.Open();
        MySqlCommand cmd = new MySqlCommand();

        cmd.Connection = c;

        cmd.CommandText = "Logweb";
        cmd.CommandType = CommandType.StoredProcedure;

        if (context != null)
        {
            MysqlSource.Add(cmd, "source", "Akuba");
            MysqlSource.Add(cmd, "message", message);
            MysqlSource.Add(cmd, "callstack", callstack);
            MysqlSource.Add(cmd, "client_ip", context.Request.UserHostAddress.ToString());
            MysqlSource.Add(cmd, "rawurl", context.Request.RawUrl);
            MysqlSource.Add(cmd, "refurl", context.Request.UrlReferrer == null ? null : context.Request.UrlReferrer.ToString());
            MysqlSource.Add(cmd, "cookie", getcookie(context.Request));
            MysqlSource.Add(cmd, "browse", context.Request.Browser == null ? null : context.Request.Browser.Browser);
            MysqlSource.Add(cmd, "method", context.Request.HttpMethod);
        }
        else
        {
            MysqlSource.Add(cmd, "source", "Akuba");
            MysqlSource.Add(cmd, "message", message);
            MysqlSource.Add(cmd, "callstack", callstack);
            MysqlSource.Add(cmd, "client_ip", "empty");
            MysqlSource.Add(cmd, "rawurl", "empty");
            MysqlSource.Add(cmd, "refurl", "empty");
            MysqlSource.Add(cmd, "cookie", "empty");
            MysqlSource.Add(cmd, "browse", "empty");
            MysqlSource.Add(cmd, "method", "empty");
        }

        cmd.ExecuteNonQuery();
        cmd.Dispose();
        c.Close();
    }