Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Spatial And Temporal Databases 11th International Symposium Sstd 2009 Aalborg Denmark July 8 10 2009 Proceedings Lncs 5644

Authors: Nikos Mamoulis ,Thomas Seidl ,Kristian Torp ,Ira Assent

2009th Edition

3642029817, 978-3642029813

More Books

Students also viewed these Databases questions

Question

What is the difference between bearer bonds and registered bonds?

Answered: 1 week ago

Question

Discuss all branches of science

Answered: 1 week ago

Question

Evaluate the impact of unions on nurses and physicians.

Answered: 1 week ago

Question

Describe the impact of strikes on patient care.

Answered: 1 week ago

Question

Evaluate long-term care insurance.

Answered: 1 week ago