当前位置:网站首页>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


边栏推荐
- kolla-ansible部署openstack yoga版本
- 新的征程
- pytorch(网络模型训练)
- Lesson 4 serial port and clock
- pytorch(网络模型)
- Operator priority, associativity, and whether to control the evaluation order [detailed explanation]
- Some doubts about ARP deception experiment
- Kolla ansible deploy openstack Yoga version
- RIA ideas
- Leetcode114. Expand binary tree into linked list
猜你喜欢

Using Jenkins to perform testng+selenium+jsup automated tests and generate extendreport test reports
![[arm] add desktop application for buildreoot of rk3568 development board](/img/9a/28015cdea7362261c39ffc7f6e13a9.png)
[arm] add desktop application for buildreoot of rk3568 development board

Kolla ansible deploy openstack Yoga version

Kolla ansible deploy openstack Yoga version

Consul service registration and discovery

电商借助小程序技术发力寻找增长突破口

421-二叉树(226. 翻转二叉树、101. 对称二叉树、104.二叉树的最大深度、222.完全二叉树的节点个数)

Combined mode, transparent mode and secure mode

Uni app ceiling fixed style

E-commerce seeks growth breakthrough with the help of small program technology
随机推荐
Unicloud cloud development obtains applet user openid
Customize WebService as a proxy to solve the problem of Silverlight calling WebService across domains
[MySQL] MySQL million level data paging query method and its optimization
Daily production training report (17)
Project suspension
Win socket programming (Mengxin initial battle)
The news of thunderbolt
421-二叉树(226. 翻转二叉树、101. 对称二叉树、104.二叉树的最大深度、222.完全二叉树的节点个数)
Bingc (inheritance)
Pytorch中自己所定义(修改)的模型加载所需部分预训练模型参数并冻结
FindControl的源代码
SQL Server 函数
Bubble sort
LeetCode_ Binary search tree_ Simple_ 108. convert an ordered array to a binary search tree
Redis usage and memory optimization
Sql语法中循环的使用
Consul service registration and discovery
Uni app ceiling fixed style
When was the autowiredannotationbeanpostprocessor instantiated?
uniCloud云开发获取小程序用户openid