Exemplo n.º 1
0
        public static int InsertLog(LogE obj)
        {
            SqlCommand com = new SqlCommand("InsertLog", Connection.Con); // Prodecure

            com.CommandType = CommandType.StoredProcedure;

            com.Parameters.Add(new SqlParameter("@type", obj.type));
            com.Parameters.Add(new SqlParameter("@message", obj.message));

            if (com.Connection.State == ConnectionState.Closed)
            {
                com.Connection.Open();
            }
            SqlDataReader rd        = com.ExecuteReader();
            int           requestID = 0;

            if (rd.HasRows)
            {
                rd.Read();
                requestID = Convert.ToInt32(rd[0]);
            }
            com.Dispose();
            com.Connection.Close();
            return(requestID);
        }
Exemplo n.º 2
0
        public void CalculateTest(double firstValue, double expected)
        {
            var calculator   = new LogE();
            var actualResult = calculator.Calculate(firstValue);

            Assert.AreEqual(expected, actualResult, 0.01);
        }
Exemplo n.º 3
0
 public static void Log(string sender, string message)
 {
     LogE?.Invoke($"[{sender}] {message}");
 }
Exemplo n.º 4
0
        public void ExceptionLessThanZeroTest(double firstArgument)
        {
            var calculator = new LogE();

            Assert.Throws <Exception>(() => calculator.Calculate(firstArgument));
        }