当前位置:网站首页>Test depends on abstraction and does not depend on concrete
Test depends on abstraction and does not depend on concrete
2022-06-26 05:52:00 【self85】
/// <summary>
/// Tests depend on abstraction and not on concrete
/// </summary>
public interface IPeople
{
void run();
void eat();
void say();
}
public class Student : IPeople
{
public void eat()
{
throw new NotImplementedException();
}
public void run()
{
throw new NotImplementedException();
}
public void say()
{
MessageBox.Show($"{
(new StackTrace()).GetFrame(0).GetMethod().ReflectedType.Name}"+":"+$"{
System.Reflection.MethodBase.GetCurrentMethod().Name}");
}
}
// 1.(new StackTrace()).GetFrame(1) // 0 Method for itself ;1 To call a method
//2.(new StackTrace()).GetFrame(1).GetMethod().Name; // Method name
//3.(new StackTrace()).GetFrame(1).GetMethod().ReflectedType.Name; // Class name
public class Teacher : IPeople
{
public void eat()
{
throw new NotImplementedException();
}
public void run()
{
throw new NotImplementedException();
}
public void say()
{
MessageBox.Show($"{
(new StackTrace()).GetFrame(0).GetMethod().ReflectedType.Name}" + ":" + $"{
System.Reflection.MethodBase.GetCurrentMethod().Name}");
// 1.(new StackTrace()).GetFrame(1) // 0 Method for itself ;1 To call a method
//2.(new StackTrace()).GetFrame(1).GetMethod().Name; // Method name
//3.(new StackTrace()).GetFrame(1).GetMethod().ReflectedType.Name; // Class name


边栏推荐
- A new journey
- Using Jenkins to perform testng+selenium+jsup automated tests and generate extendreport test reports
- 5分钟包你学会正则表达式
- Adapter mode
- pytorch(网络模型训练)
- 小程序如何关联微信小程序二维码,实现二码聚合
- one billion two hundred and twelve million three hundred and twelve thousand three hundred and twenty-one
- Security problems in wireless networks and modern solutions
- Thinking about bad money expelling good money
- ZigBee explain in simple terms lesson 2 hardware related and IO operation
猜你喜欢
随机推荐
虚拟项目失败感想
劣币驱逐良币的思考
Win socket programming (Mengxin initial battle)
机器学习 05:非线性支持向量机
Unicloud cloud development obtains applet user openid
E-commerce seeks growth breakthrough with the help of small program technology
Given two corresponding point sets AB, how to estimate the parameters of the specified transformation matrix R?
Explore small program audio and video calls and interactive live broadcast from New Oriental live broadcast
Gram matrix
Life is so fragile
423- binary tree (110. balanced binary tree, 257. all paths of binary tree, 100. same tree, 404. sum of left leaves)
tf.nn.top_k()
小程序第三方微信授权登录的实现
The news of thunderbolt
Internship May 29, 2019
【C语言】深度剖析数据在内存中的存储
Operator priority, associativity, and whether to control the evaluation order [detailed explanation]
String类学习
[arm] build boa based embedded web server on nuc977
循环位移








