Example #1
0
        public void AverageConditionObserver_DisplayOutput_TempAverageOutputShouldBeAverageOFInputs()
        {
            SensorSubject testSubject = new SensorSubject();
            ListBox testListbox = new ListBox();

            AverageReadingObserver testAverageObserver  = new AverageReadingObserver(testListbox, testSubject);

            testSubject.InputTrigger("10", " 20", "30");
            testListbox.Items.Clear();
            testSubject.InputTrigger("10", " 20", "30");
            testListbox.Items.Clear();
            testSubject.InputTrigger("30", " 20", "10");

            String output = testListbox.Items[0].ToString();

            String expectedOutput = "Temperature:\t16.67";

            Assert.AreEqual(expectedOutput, output);
        }
Example #2
0
        public void CuttentTempObserver_DisplayOutput_PressureINputShouldEqualOutput()
        {
            SensorSubject testSubject = new SensorSubject();

            ListBox testListbox = new ListBox();

            CurrentReadingsObserver CReadOb = new CurrentReadingsObserver(testListbox, testSubject);

            testSubject.InputTrigger("10", " 20", "30");

            String output = testListbox.Items[2].ToString();

            String expectedOutput = "Pressure:\t30.00";

            Assert.AreEqual(expectedOutput, output);
        }
Example #3
0
        public void ForcastConditionObserver_DisplayOutput_MediumPressureIndicatewetWeather()
        {
            SensorSubject testSubject = new SensorSubject();
            ListBox testListbox = new ListBox();

            ForcastObserver testAverageObserver = new ForcastObserver(testListbox, testSubject);

            testSubject.InputTrigger("10", " 20", "1000");

            String output = testListbox.Items[0].ToString();

            String expectedOutput = "Wet weather coming";

            Assert.AreEqual(expectedOutput, output);
        }