Exemplo n.º 1
0
    public void HasHistory_yes()
    {
        var ws = new WeatherStation();

        ws.AcceptReading(new Reading(20m, 25m, 0.01m, WindDirection.Unknown));
        ws.AcceptReading(new Reading(21m, 25m, 0.00m, WindDirection.Unknown));
        Assert.True(ws.HasHistory);
    }
Exemplo n.º 2
0
    public void ClearAll()
    {
        var ws = new WeatherStation();

        ws.AcceptReading(new Reading(20m, 25m, 0.01m, WindDirection.Unknown));
        ws.AcceptReading(new Reading(21m, 25m, 0.00m, WindDirection.Unknown));
        ws.ClearAll();
        object[] expected = { false, 0m };
        object[] actual   = { ws.HasHistory, ws.LatestTemperature };
        Assert.Equal(expected, actual);
    }
Exemplo n.º 3
0
    public void RunSelfTest_good()
    {
        var ws = new WeatherStation();

        ws.AcceptReading(new Reading(40m, 7m, 0m, WindDirection.Unknown));
        Assert.Equal(State.Good, ws.RunSelfTest());
    }
Exemplo n.º 4
0
    public void ShortTermOutlook_warm()
    {
        var ws = new WeatherStation();

        ws.AcceptReading(new Reading(40m, 7m, 0m, WindDirection.Unknown));
        Assert.Equal(Outlook.Warm, ws.ShortTermOutlook);
    }
Exemplo n.º 5
0
    public void LongTermOutlook_rainy()
    {
        var ws = new WeatherStation();

        ws.AcceptReading(new Reading(21m, 7m, 0m, WindDirection.Westerly));
        Assert.Equal(Outlook.Rainy, ws.LongTermOutlook);
    }
Exemplo n.º 6
0
    public void LongTermOutlook_warm()
    {
        var ws = new WeatherStation();

        ws.AcceptReading(new Reading(7m, 7m, 0m, WindDirection.Easterly));
        Assert.Equal(Outlook.Warm, ws.LongTermOutlook);
    }
Exemplo n.º 7
0
    public void LongTermOutlook_good2()
    {
        var ws = new WeatherStation();

        ws.AcceptReading(new Reading(7m, 7m, 0m, WindDirection.Southerly));
        Assert.Equal(Outlook.Good, ws.LongTermOutlook);
    }
Exemplo n.º 8
0
    public void LongTermOutlook_cool()
    {
        var ws = new WeatherStation();

        ws.AcceptReading(new Reading(7m, 7m, 0m, WindDirection.Northerly));
        Assert.Equal(Outlook.Cool, ws.LongTermOutlook);
    }
Exemplo n.º 9
0
    public void GetReading()
    {
        var ws = new WeatherStation();

        ws.AcceptReading(new Reading(20m, 25m, 0.01m, WindDirection.Unknown));
        decimal[] expected = { 20, 25, 0.01m };
        decimal[] actual   = { ws.LatestTemperature, ws.LatestPressure, ws.LatestRainfall };
        Assert.Equal(expected, actual);
    }