Define the components apPRopriately for the application and create project for each one.
3 Things: Visual Things, Business Things (Domain Entities), Application Things (like Logging & Email Generation)
3 Types: User interface classes, Domain entity classes, Library class
Class is a template or mold,specifies the traits or data,specifies the behavior or Operations.
類是一種模板或模具,指定了具體數據或者是行為操作等。
3 Advantages:
Higher Code Quality, Faster and Easier Debugging, Repeatable
Features:
Tests the behavior of a unit of code (often a method), Automated, Defined with code,Identifies errors
Tools:
MSTest, NUnit
Steps:
1.Define the test scenarios, 2.Generate the tests, 3.Execute the tests
Arrange -> Act -> Assert
1.Why is a layer architecture important?
Logical components are easier to create,change,extend and maintain
Code are easier to reuse
2.What is a class?
A template for the objects created at runtime
Specifies the data and operations for each entity
3.What are the benefits of unit testing?
Higher quality code,faster and easier debugging,and they are repeatable over the life of the application
無或internal:只能在當前項目中訪問類
public:可以在任何地方訪問類
abstract或internal abstract:不能實例化,只能供繼承之用(只能在當前項目中訪問)
public abstract:同上,但可以在任何地方訪問
sealed或internel sealed:不能供派生之用,只能實例化(只能在當前項目中訪問)
public sealed:同上,但可以在任何地方訪問
類似:
都不能實例化,都包含可以由派生類繼承的成員。
區別:
1、派生類只能繼承一個基類,但類可以繼承任意多個接口。
2、抽象類的成員可以擁有代碼體(即代碼實現),而接口成員沒有代碼體,都必須在使用接口的類上實現。
3、接口成員是公共的,而抽象類的成員可以是private, protected, internal or protected internal。
4、接口不能包含字段、構造函數、析構函數、靜態成員或常量。
新聞熱點
疑難解答