Exemple #1
0
            public static void CallsReadWord()
            {
                var cfg = new FanConfiguration()
                {
                    ReadRegister  = 123,
                    MinSpeedValue = 0,
                    MaxSpeedValue = 20000
                };

                var ec = A.Fake <IEmbeddedController>();

                A.CallTo(() => ec.AcquireLock(A <int> .Ignored)).Returns(true);
                A.CallTo(() => ec.ReadWord((byte)cfg.ReadRegister)).Returns((ushort)cfg.MaxSpeedValue);

                var fan = new Fan(ec, cfg, 100, true);

                fan.GetCurrentSpeed();

                A.CallTo(() => ec.ReadWord((byte)cfg.ReadRegister)).MustHaveHappened();
                Assert.Equal(100, fan.CurrentSpeed);
            }