Esempio n. 1
0
        public void CannotCallResetProtectionTooHighTemperature()
        {
            AsyncContext.Run(async() =>
            {
                bool resetCalled      = false;
                var cancellationToken = CancellationToken.None;

                var instance = new ServiceSimulation(
                    SynchronizationContext.Current,
                    1000,
                    true,
                    140m,
                    1.3m,
                    0.0m,
                    0.0m,
                    true);

                instance.Protection.Subscribe(x =>
                {
                    if (!x)
                    {
                        resetCalled = true;
                    }
                });

                Func <Task> act = () => instance.ResetProtection(cancellationToken);

                await act.Should().ThrowAsync <BoilerException>();
                resetCalled.Should().BeFalse();
            });
        }
Esempio n. 2
0
        public void CanCallResetProtection()
        {
            AsyncContext.Run(async() =>
            {
                bool resetCalled = false;

                var cancellationToken = CancellationToken.None;

                var instance = new ServiceSimulation(
                    SynchronizationContext.Current,
                    1000,
                    true,
                    0m,
                    1.3m,
                    0.0m,
                    0.0m,
                    true);

                instance.Protection.Subscribe(x =>
                {
                    if (!x)
                    {
                        resetCalled = true;
                    }
                });

                await instance.ResetProtection(cancellationToken);
                resetCalled.Should().BeTrue();
            });
        }