Beispiel #1
0
        public void OutputPostBuilder_WithConsumption_SetConsumption()
        {
            var builder = new OutputPostBuilder().SetDate(DateTime.Today)
                          .SetConsumption(25000);

            Assert.That(builder.OutputPost.Consumption, Is.EqualTo(25000));
        }
Beispiel #2
0
        public void OutputPostBuilder_WithPeakPower_SetsPeakPower()
        {
            var builder = new OutputPostBuilder().SetDate(DateTime.Today)
                          .SetPeakPower(13131);

            Assert.That(builder.OutputPost.PeakPower, Is.EqualTo(13131));
        }
Beispiel #3
0
 public void OutputPostBuilder_WithTimeComponent_Throws()
 {
     Assert.Throws <ArgumentException>(() =>
     {
         _ = new OutputPostBuilder().SetDate(DateTime.Today.AddMinutes(10));
     });
 }
Beispiel #4
0
        public void OutputPostBuilder_WithExported_SetsExported()
        {
            var builder = new OutputPostBuilder().SetDate(DateTime.Today)
                          .SetEnergyExported(12121);

            Assert.That(builder.OutputPost.EnergyExported, Is.EqualTo(12121));
        }
Beispiel #5
0
        public void OutputPostBuilder_WithGeneration_SetsGeneration()
        {
            var builder = new OutputPostBuilder().SetDate(DateTime.Today)
                          .SetEnergyGenerated(12121);

            Assert.That(builder.OutputPost.EnergyGenerated, Is.EqualTo(12121));
        }
Beispiel #6
0
 public void OutputPostBuilder_WithNegativeHighShoulderEnergyImport_Throws()
 {
     Assert.Throws <ArgumentOutOfRangeException>(() =>
     {
         _ = new OutputPostBuilder().SetHighShoulderEnergyImport(-1);
     });
 }
Beispiel #7
0
 public void OutputPostBuilder_WithNegativeExported_Throws()
 {
     Assert.Throws <ArgumentOutOfRangeException>(() =>
     {
         _ = new OutputPostBuilder().SetEnergyExported(-1);
     });
 }
Beispiel #8
0
        public void OutputPostBuilder_WithHighShoulderEnergyImport_SetHighShoulderEnergyImport()
        {
            var builder = new OutputPostBuilder().SetDate(DateTime.Today)
                          .SetHighShoulderEnergyImport(13131);

            Assert.That(builder.OutputPost.HighShoulderEnergyImport, Is.EqualTo(13131));
        }
Beispiel #9
0
        public void OutputPostBuilder_WithOffPeakImport_SetsOffPeakEnergyImport()
        {
            var builder = new OutputPostBuilder().SetDate(DateTime.Today)
                          .SetOffPeakEnergyImport(13131);

            Assert.That(builder.OutputPost.OffPeakEnergyImport, Is.EqualTo(13131));
        }
Beispiel #10
0
        public void OutputPostBuilder_WithPeakTimeSpan_SetsPeakTime()
        {
            var builder = new OutputPostBuilder().SetDate(new DateTime(2020, 1, 1))
                          .SetPeakTime(new TimeSpan(10, 10, 0));

            Assert.That(builder.OutputPost.PeakTime.Value, Is.EqualTo(new TimeSpan(10, 10, 0)));
        }
Beispiel #11
0
        public void OutputPostBuilder_AfterBuildAndReset_HasNoStateLeft()
        {
            var         builder = new OutputPostBuilder().SetDate(DateTime.Today);
            IOutputPost output  = builder.BuildAndReset();

            Assert.That(builder.OutputPost, Is.Not.SameAs(output));
        }
Beispiel #12
0
 public void OutputPostBuilder_WithNegativeConsumption_Throws()
 {
     Assert.Throws <ArgumentOutOfRangeException>(() =>
     {
         _ = new OutputPostBuilder().SetConsumption(-1);
     });
 }
Beispiel #13
0
        public void OutputPostBuilder_WithTemperatures_SetsCorrectTemperature(decimal?minimum, decimal?maximum)
        {
            var builder = new OutputPostBuilder().SetDate(DateTime.Today)
                          .SetTemperatures(minimum, maximum);

            Assert.That(builder.OutputPost.MinimumTemperature, Is.EqualTo(minimum));
            Assert.That(builder.OutputPost.MaximumTemperature, Is.EqualTo(maximum));
        }
Beispiel #14
0
        public void OutputPostBuilder_WithComment_SetsComment()
        {
            const string testComment = "This is a comment";
            var          builder     = new OutputPostBuilder().SetDate(DateTime.Today)
                                       .SetComments(testComment);

            Assert.That(builder.OutputPost.Comments, Is.EqualTo(testComment));
        }
Beispiel #15
0
        public void OutputPostBuilder_WithCondition_SetsCondition()
        {
            const WeatherCondition testCondition = WeatherCondition.PartlyCloudy;
            var builder = new OutputPostBuilder().SetDate(DateTime.Today)
                          .SetCondition(testCondition);

            Assert.That(builder.OutputPost.Condition, Is.EqualTo(testCondition));
        }
Beispiel #16
0
        public void OutputPostBuilder_WithReversedTemperatures_Throws()
        {
            var builder = new OutputPostBuilder().SetDate(DateTime.Today);

            Assert.Throws <ArgumentOutOfRangeException>(() =>
            {
                builder.SetTemperatures(15, 10);
            });
        }
Beispiel #17
0
        public void OutputPostBuilder_WithNullComment_Throws()
        {
            var builder = new OutputPostBuilder().SetDate(DateTime.Today);

            Assert.Throws <ArgumentNullException>(() =>
            {
                builder.SetComments(null);
            });
        }
Beispiel #18
0
        public void OutputPostBuilder_WithBothNullTemperatures_Throws()
        {
            var builder = new OutputPostBuilder().SetDate(DateTime.Today);

            Assert.Throws <ArgumentNullException>(() =>
            {
                builder.SetTemperatures(null, null);
            });
        }
Beispiel #19
0
        public void OutputPostBuilder_WithoutDate_CannotBuild()
        {
            var builder = new OutputPostBuilder().SetEnergyGenerated(10000);

            Assert.Throws <InvalidOperationException>(() =>
            {
                builder.Build();
            });
        }
Beispiel #20
0
        public void OutputPostBuilder_WithDate_SetsDate()
        {
            var builder = new OutputPostBuilder().SetDate(DateTime.Today);

            Assert.That(builder.OutputPost.OutputDate, Is.EqualTo(DateTime.Today));
        }