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); }
public void CalculateTest(double firstValue, double expected) { var calculator = new LogE(); var actualResult = calculator.Calculate(firstValue); Assert.AreEqual(expected, actualResult, 0.01); }
public static void Log(string sender, string message) { LogE?.Invoke($"[{sender}] {message}"); }
public void ExceptionLessThanZeroTest(double firstArgument) { var calculator = new LogE(); Assert.Throws <Exception>(() => calculator.Calculate(firstArgument)); }