public void SetUp()
 {
     input = new FakeInput();
     output = new FakeOutput();
     pid = new PIDController(0.05, 0.0, 0.0, input, output);
     pid.SetInputRange(-range/2, range/2);
 }
Beispiel #2
0
        public void TestOutput_Simple()
        {
            FakeOutput Output     = new FakeOutput();
            string     testString = "Hello World";

            Output.WriteLine(testString);
            Assert.AreEqual(Output.OutputString, testString);
        }
Beispiel #3
0
        public void TestOutput_PlayUnknownHeadset()
        {
            FakeOutput     Output  = new FakeOutput();
            UnknownHeadset headset = new UnknownHeadset(Output);

            headset.Play(null);
            Assert.AreEqual(Output.OutputString, "UnknownHeadset sound");
        }
Beispiel #4
0
        public void TestOutput_PlaySamsungHeadset()
        {
            FakeOutput     Output  = new FakeOutput();
            SamsungHeadset headset = new SamsungHeadset(Output);

            headset.Play(null);
            Assert.AreEqual(Output.OutputString, "SamsungHeadset sound");
        }
Beispiel #5
0
        public void TestOutput_PlayiPhoneHeadset()
        {
            FakeOutput    Output  = new FakeOutput();
            iPhoneHeadset headset = new iPhoneHeadset(Output);

            headset.Play(null);
            Assert.AreEqual(Output.OutputString, "iPhoneHeadset sound");
        }
        public void ChargeValidOutputText()
        {
            var output  = new FakeOutput();
            var charger = new USBCharger(output, 1.5f, USBCharger.Ports.DedicatedChargingPort);

            charger.Charge();

            Assert.AreEqual("Charge with USBCharger\n", output.OutputResult);
        }
Beispiel #7
0
        public void ChargeValidOutputText()
        {
            FakeOutput      output  = new FakeOutput();
            WirelessCharger charger = new WirelessCharger(output, 1.5f);

            charger.Charge();

            Assert.AreEqual("Charge with WirelessCharger\n", output.OutputResult);
        }
        public void PlayValidOutputText()
        {
            var output  = new FakeOutput();
            var headset = new IPhoneHeadset(output, "2156:2356");
            var data    = new object();

            headset.Play(data);

            Assert.AreEqual("IPhoneHeadset sound\n", output.OutputResult);
        }
        public void PlayValidOutputText()
        {
            var output  = new FakeOutput();
            var headset = new PhoneSpeaker(output, 25.0f);
            var Data    = new object();

            headset.Play(Data);

            Assert.AreEqual("PhoneSpeaker sound\n", output.OutputResult);
        }
        public void PlayValidOutputText()
        {
            var output  = new FakeOutput();
            var plug    = new AudioPlug(200, 100, 3.5f);
            var headset = new SamsungHeadset(output, plug);
            var data    = new object();

            headset.Play(data);

            Assert.AreEqual("SamsungHeadset sound\n", output.OutputResult);
        }
Beispiel #11
0
        public void PlaybackBase_Volume_LessThan0ErrorMessage()
        {
            //Arrange
            FakeOutput fakeOutput = new FakeOutput();
            //Act
            var actual = Assert.ThrowsException <ArgumentOutOfRangeException>(() => new AirPods(volume: -1, fakeOutput));

            //Assert
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => new AirPods(volume: -1, fakeOutput));
            Assert.AreEqual("Value should be from 0 to 100\r\nParameter name: 0", actual.Message);
        }
        public void Charge_OnePlusWarpCharge30()
        {
            //Arrange
            FakeOutput fakeOutput = new FakeOutput();
            var        expected   = $"Battery now is charging using OnePlusWarpCharge30\nWow, this charging speed must be illegal, right?\n\n";
            //Act
            var charger = new OnePlusWarpCharge30(inductiveCharge: true, BatteryChargerBase._ChargingTechnology.OnePlus_WarpCharge30, fakeOutput);

            charger.Charge();
            //Assert
            Assert.AreEqual(expected, fakeOutput.GetOutputAsText());
        }
Beispiel #13
0
        public void Play_AirPodsPro()
        {
            //Arrange
            FakeOutput fakeOutput = new FakeOutput();
            var        expected   = "Do you hear this test sound? Me too\n";
            //Act
            var airPodsPro = new AirPodsPro(volume: 75, fakeOutput);

            airPodsPro.Play("Do you hear this test sound? Me too");
            //Assert
            Assert.AreEqual(expected, fakeOutput.GetOutputAsText());
        }
Beispiel #14
0
        public void Play_GalaxyBudsLive()
        {
            //Arrange
            FakeOutput fakeOutput = new FakeOutput();
            var        expected   = "Do you hear this test sound? Me too\n";
            //Act
            var galaxyBudsLive = new GalaxyBudsLive(volume: 75, fakeOutput);

            galaxyBudsLive.Play("Do you hear this test sound? Me too");
            //Assert
            Assert.AreEqual(expected, fakeOutput.GetOutputAsText());
        }
Beispiel #15
0
        public void Play_HomePod()
        {
            //Arrange
            FakeOutput fakeOutput = new FakeOutput();
            var        expected   = "Do you hear this test sound? Me too\n";
            //Act
            var homePod = new HomePod(volume: 75, fakeOutput);

            homePod.Play("Do you hear this test sound? Me too");
            //Assert
            Assert.AreEqual(expected, fakeOutput.GetOutputAsText());
        }
Beispiel #16
0
        public void Play_NoNameHeadSet()
        {
            //Arrange
            FakeOutput fakeOutput = new FakeOutput();
            var        expected   = "Do you hear this test sound? Me too\n";
            //Act
            var noNameHeadSet = new NoNameHeadSet(volume: 75, fakeOutput);

            noNameHeadSet.Play("Do you hear this test sound? Me too");
            //Assert
            Assert.AreEqual(expected, fakeOutput.GetOutputAsText());
        }
Beispiel #17
0
        public void InstallBattery_BatteryNiMH()
        {
            //Arrange
            FakeOutput fakeOutput = new FakeOutput();
            var        expected   = $"BatteryNiMH now is supply power to Mobile Phone\n";
            //Act
            var batteryNiMH = new BatteryNiMH(capacity: 666, "", fakeOutput);

            batteryNiMH.InstallBattery();
            //Assert
            Assert.AreEqual(expected, fakeOutput.GetOutputAsText());
        }
Beispiel #18
0
        public void Play_PhoneSpeaker()
        {
            //Arrange
            FakeOutput fakeOutput = new FakeOutput();
            var        expected   = "Do you hear this test sound? Me too\n";
            //Act
            var phoneSpeaker = new PhoneSpeaker(volume: 75, fakeOutput);

            phoneSpeaker.Play("Do you hear this test sound? Me too");
            //Assert
            Assert.AreEqual(expected, fakeOutput.GetOutputAsText());
        }
        public void Charge_MediaTekPumpExpress4_0()
        {
            //Arrange
            FakeOutput fakeOutput = new FakeOutput();
            var        expected   = $"Battery now is charging using MediaTekPumpExpress4_0\nWow, this charging speed must be illegal, right?\n\n";
            //Act
            var charger = new MediaTekPumpExpress4_0(inductiveCharge: true, BatteryChargerBase._ChargingTechnology.MediaTek_PumpExpress4_0, fakeOutput);

            charger.Charge();
            //Assert
            Assert.AreEqual(expected, fakeOutput.GetOutputAsText());
        }
        public void Charge_SamsungAdaptiveFastCharger()
        {
            //Arrange
            FakeOutput fakeOutput = new FakeOutput();
            var        expected   = $"Battery now is charging using SamsungAdaptiveFastCharger\nWow, this charging speed must be illegal, right?\n\n";
            //Act
            var charger = new SamsungAdaptiveFastCharger(inductiveCharge: true, BatteryChargerBase._ChargingTechnology.Samsung_AdaptiveFastCharger, fakeOutput);

            charger.Charge();
            //Assert
            Assert.AreEqual(expected, fakeOutput.GetOutputAsText());
        }
        public void Charge_AppleFastCharge()
        {
            //Arrange
            FakeOutput fakeOutput = new FakeOutput();
            var        expected   = $"Battery now is charging using AppleFastCharge\nWow, this charging speed must be illegal, right?\n\n";
            //Act
            var appleFastCharge = new AppleFastCharge(inductiveCharge: true, BatteryChargerBase._ChargingTechnology.Apple_FastCharge, fakeOutput);

            appleFastCharge.Charge();
            //Assert
            Assert.AreEqual(expected, fakeOutput.GetOutputAsText());
        }
        public void Play_IPhoneHeadsetSelected_GetIPhoneHeadset()
        {
            // Arrange
            var output        = new FakeOutput();
            var iphoneheadset = new iPhoneHeadset(output);

            // Act
            iphoneheadset.Play(iphoneheadset);
            var result = output.GetText();

            // Assert
            Assert.AreEqual("iPhoneHeadset", result);
        }
        public void Play_SamsungHeadsetSelected_GetSamsungHeadset()
        {
            // Arrange
            var output         = new FakeOutput();
            var samsungheadset = new SamsungHeadset(output);

            // Act
            samsungheadset.Play(samsungheadset);
            var result = output.GetText();

            // Assert
            Assert.AreEqual("SamsungHeadset", result);
        }
        public void Play_UnofficialiPhoneHeadsetSelected_GetUnofficialiPhoneHeadset()
        {
            // Arrange
            var output = new FakeOutput();
            var unofficialiphoneheadset = new UnofficialIPhoneHeadset(output);

            // Act

            unofficialiphoneheadset.Play(unofficialiphoneheadset);
            var result = output.GetText();

            // Assert
            Assert.AreEqual("UnofficialIPhoneHeadset", result);
        }
        public void Play_PhoneSpeakerSelected_GetPhoneSpeaker()
        {
            // Arrange
            var output       = new FakeOutput();
            var phonespeaker = new PhoneSpeaker(output);

            // Act

            phonespeaker.Play(phonespeaker);
            var result = output.GetText();

            // Assert
            Assert.AreEqual("PhoneSpeaker", result);
        }
Beispiel #26
0
        public ProgramTests()
        {
            _input = new FakeInput();
            _input.EnterLine("5:00 PM");
            _input.EnterLine("9:00 PM");
            _input.EnterLine("9:00 PM");

            _output = new FakeOutput();
            var services = new ServiceCollection()
                           .AddBabySitterCli()
                           .Replace(new ServiceDescriptor(typeof(IOutput), p => _output, ServiceLifetime.Singleton))
                           .Replace(new ServiceDescriptor(typeof(IInput), p => _input, ServiceLifetime.Singleton));

            _program = new Program(services);
        }
 public FrameTestsBase()
 {
     Services = new FakeServices();
     App      = new FakeApp();
     Output   = new FakeOutput();
     Input    = new FakeInput();
     Frame    = new Frame(
         new FrameContext
     {
         Services = Services,
         App      = App.Call,
         Write    = Output.Write,
         Flush    = Output.Flush,
         End      = Output.End,
     });
     Input.Consume = (baton, callback) => Frame.Consume(baton, (frame, ex) => callback(ex));
 }
Beispiel #28
0
        public async Task FakeHttpMessageHandler_Verify_ReturnsOutputOverride()
        {
            var output = new FakeOutput {
                FakeProperty = "MyFakeProperty"
            };

            var handler = new FakeHttpMessageHandler <FakeOutput>(output);


            using (var httpClient = new HttpClient(handler, true))
            {
                var responce = await httpClient.GetAsync(_requestUri);

                var responseText = await responce.Content.ReadAsStringAsync();

                var clientOutput = JsonConvert.DeserializeObject <FakeOutput>(responseText);

                clientOutput.Should().NotBeNull();
                clientOutput.Should().BeEquivalentTo(output);
                clientOutput.FakeProperty.Should().NotBeNullOrWhiteSpace();
                handler.CallsCount.Should().Be(1);
            }
        }
 public void SetUp()
 {
     _output = new FakeOutput();
     _consumer = new DeploymentProcessOutputConsumer(_output);
 }