Question: Create a console OR WIndows Form project using C# called ThermostatProject. The program must manage a thermostat that can be set with a target temperature

Create a console OR WIndows Form project using C# called ThermostatProject.

The program must manage a thermostat that can be set with a target temperature that can be regulated within a rang of present temperatures. Create a testing class and add the class to be tested.

1. You should have two projects in your solution, ThermostatProject and ThermostatProjectTests by select Create Unit Tests

2. Test method in ThermosateTest class must create a new thermostat object and initialize the lower limit to 10, upper limit to 50, and set the initial temperature to 20. Testing the increments of the temperatures with the default increase of 5 degrees brings the temperature to 25.

3. Declare a thermostat object and pass default values to it inside the test method

4. to increment the temperature on the Thermostats, in the test method, decide what the method call should be and type in the call to the as yet non-existen method ( t.Increment();)

5. Then test the temperature is indeed 25 after incrementing

int expected =25;

int actal= t.Temperature;

Assert.AreEqual(expected,actual)

6.FIx the Thermostat Class to run and keep the temperature in the proper range.

7. Add a test method to the test class that creates a new thermostat object and initializes the lower limit to 10, the upper limit to 50, and sets the initial temperature to 20 (hmm, we're creating some duplication here from the last test case - we'll have to deal with that later):

8. Increment to get past the max limit.using a a "for loop"

for (int i = 0; i<7; i++)

{

t.Increment();

}

then add

Assert.AreEqual(50, t.Temperature);

9. make sure the increment method does not go above the max limit

10. Set up test fixture and be able to use the object in all tests by declaring variable as an instance variable;11.create the object in a method marked with [TestInitialize]:

11. ALLOW for decrementing the temperature and make sure temperature can't drop below MIN

12.Make the Temperature property read-only so it can only be changed through the Increment and Decrement methods

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!