** Pass Task 7: Unit Testing the Unit class (Assessed Task) Return to Pass Task 3 Program. Add Unit Tests to check the f

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

** Pass Task 7: Unit Testing the Unit class (Assessed Task) Return to Pass Task 3 Program. Add Unit Tests to check the f

Post by answerhappygod »

Pass Task 7 Unit Testing The Unit Class Assessed Task Return To Pass Task 3 Program Add Unit Tests To Check The F 1
Pass Task 7 Unit Testing The Unit Class Assessed Task Return To Pass Task 3 Program Add Unit Tests To Check The F 1 (69.67 KiB) Viewed 48 times
Use pass task 3 to solve pass task 7 and 8
Pass task 3 Code:
Unit.cs:
public class Unit
{
private string _code;
private string _name;
private AssesmentType _type;
private TeachingMode _mode;
private string[] _preRequisites;
/// <summary>
/// constructor
/// </summary>
/// <param
name="code"></param>
/// <param
name="name"></param>
/// <param
name="type"></param>
/// <param
name="mode"></param>
/// <param
name="preRequisites"></param>
public Unit(string code, string name,
AssesmentType type, TeachingMode mode, string[]
preRequisites)
{
_code = code;
_name = name;
_type = type;
_mode = mode;
_preRequisites =
preRequisites;
}
public string Code { get { return _code; }
}
public string Name { get { return _name; }
}
public AssesmentType Type { get { return _type;
} }
public TeachingMode Mode { get { return _mode; }
}
public string[] PreRequisites { get { return
_preRequisites; } }
/// <summary>
///
/// </summary>
/// <returns> a message depending on the
assesment type</returns>
public string InformUnitDetails()
{
if (_type ==
AssesmentType.Portfolio)
{

return "Get ready with a lot of hands-on for this semester";
}
else if (_type ==
AssesmentType.FinalExamBased)
{

return "Get ready with quizzes and tests";
}
else
{

return "Invalid category";
}
}
}
AssesmentType.cs:
public enum AssesmentType
{
Portfolio,
FinalExamBased
}
TeachingMode.cs:
public enum TeachingMode
{
F2F,
Online,
Blended
}
Program.cs:
public class Program
{
static void Main(string[] args)
{
// Add an array of 2
units to Main
Unit[] units = new
Unit[2];
// Initialize the array
with 2 new Unit objects
units[0] = new
Unit("COS20007", "OOP", AssesmentType.Portfolio,
TeachingMode.Blended, new string[] { "COS10009" });
units[1] = new
Unit("COS30019", "AI", AssesmentType.FinalExamBased,
TeachingMode.F2F, new string[] { "COS20007", "COS30008" });
// Use DisplayInfo to
execute all of the units

DisplayInfo(units);
}
/// <summary>
/// Displays the units information and result of
InformUnitDetails
/// </summary>
/// <param
name="units"></param>
static void DisplayInfo(Unit[] units)
{
// iterate through the
array and display the units info
for (int index = 0;
index < units.Length; index++)
{

Console.WriteLine(units[index].Code + "|" + units[index].Mode + "|"
+ units[index].Type);

Console.WriteLine(units[index].InformUnitDetails());

Console.WriteLine();
}
}
}
** Pass Task 7: Unit Testing the Unit class (Assessed Task) Return to Pass Task 3 Program. Add Unit Tests to check the functionality of the Unit class as indicated below: Unit Test Name Descriptions Check you can create an Unit object of Assessment Type Portfolio and it returns the right messages upon calling the TestPortfolio InformUnitDetails() Check you can create an Unit object of Type FinalExamBased and it returns the right messages upon calling the TestFinalExamBased InformUnitDetails() Check you can create an Unit object with an array of two prerequisites and it returns the right pre- requisites upon calling the get method of the pre- TestPreRequisites requisites field. Pass Task 7 - Assessment Criteria Make sure that your task has the following in your submission: The unit tests correctly check the output from the different assessment types of Unit and its pre-requisites. Code must follow the C# coding convention used in the unit (layout, and use of case). The code must compile and the screenshot show the tests passing.

** Pass Task 8: Documenting the Unit Class (Assessed Task) In a real-world project, it is critically important to document your code. Software is developed in teams, and documentation can help everyone quickly understand what the classes, methods, and properties of your code do. C# provides a code documentation standard called XML documentation. The great thing about this documentation is that it is read and understood by the IDE, so when you document the method and classes in your project that documentation is immediately useful. In your Pass Task 7 program, add XML documentation to the Unit class by adding III to the line before the class, constructor, method or property header. This will start the documentation for you. Perform the following: Write a short description for the class itself. Write descriptions for the constructor, methods and properties within the class. Pass Task 8 - Assessment Criteria Make sure that your task has the following in your submission: All public features of the Unit class have XML documentation. Code must follow the C# coding convention used in the unit (layout, and use of case).

SAMPLE RUN FOR PASS TASK 3: COS20007|Blended|Portfolio Get ready with a lot of hands-on for this semester COS 30019|F2F|FinalExamBased Get ready with quizzes and tests
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply