tailieunhanh - NET Domain-Driven Design with C#P roblem – Design – Solution phần 3

sử dụng hệ thống; không gian tên {lớp trừu tượng công chúng EntityBase {private đối tượng quan trọng, / / / / / / Default Constructor. / / / Bảo vệ EntityBase (): (null) {} / / / / / / constructor quá tải. | Chapter 3 Managing Projects summary A test for FindBy object sector object segment bool completed summary DeploymentItem TestMethod public void FindBySegmentsAndNotCompletedTest Create a list of Market Segments List MarketSegment segments new List MarketSegment new MarketSegment 1 null test test Pass the Market Segments into the FindBy method and specify Projects that have NOT completed yet IList Project projects segments false Make sure there is one project that matches the criteria 1 The first thing to notice about this method is how it is decorated with the two different attributes the Deploymentitem attribute and the TestMethod attribute. The Deploymentitem attribute lets the VSTS test host know to copy the SQL CE project file to the output directory of the unit test project. This is important because otherwise I would not be able to connect to the database in the test. The TestMethod attribute lets VSTS know that this is a unit test and it will be recognized as such by the VSTS unit testing UI. This test code starts out by creating a dummy Marketsegment instance and adds it to a generic List of type Marketsegment. I then pass the list of Market Segments into the IProjectRepository s overloaded FindBy method to have an iList of type Project returned. The test occurs on the last line when I assert that there should be one Project returned from the iProjectRepository method. If the assertion is true then the test will pass. As of this point in the chapter this test and all others in this class should fail because I have not written the IProjectRepository implementation yet. The FindByProjectNumberTest Method This method validates the ability to get a Project instance based on the Number of a Project summary A test for FindBy string projectNumber summary DeploymentItem TestMethod public void FindByProjectNumberTest The Project Number string projectNumber

TỪ KHÓA LIÊN QUAN
crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.