public void ScreenGetTest()
        {
            var output = new OutputMock();
            var mobile = new PhoneStub(output);

            Assert.IsTrue(mobile.Screen is OLEDScreen);
        }
Ejemplo n.º 2
0
        public void ChargeTest()
        {
            var output  = new OutputMock();
            var mobile  = new PhoneStub(output);
            var charger = new USBCharger(output);

            mobile.Charge(charger);

            Assert.IsTrue(output.Output.ToUpper().Contains("CHARGING"));
        }
        public void PhoneSpeaker_IsPlay()
        {
            // Arrange / Act
            IOutput   output   = new OutputMock();
            IPlayback playback = new PhoneSpeaker(output);

            playback.Play(output);

            //Assert
            Assert.IsTrue(output.Output.ToString().Contains("PhoneSpeaker"));
        }
        public void PlayTest()
        {
            var output   = new OutputMock();
            var mobile   = new PhoneStub(output);
            var playback = new IphoneHeadset(output);

            mobile.PlaybackComponent = playback;
            mobile.Play(new object());

            Assert.IsTrue(output.Output.ToUpper().Contains("SOUND"));
        }
Ejemplo n.º 5
0
        public void UnoffocoaliPhoneHeadset_IsPlay()
        {
            // Arrange / Act
            IOutput   output   = new OutputMock();
            IPlayback playback = new UnoffocoaliPhoneHeadset(output);

            playback.Play(output);

            //Assert
            Assert.IsTrue(output.Output.ToString().Contains("UnoffocoaliPhoneHeadset"));
        }
        public void SamsungHeadset_IsPlay()
        {
            // Arrange / Act
            IOutput   output   = new OutputMock();
            IPlayback playback = new SamsungHeadset(output);

            playback.Play(output);

            //Assert
            Assert.IsTrue(output.Output.ToString().Contains("SamsungHeadset"));
        }
        public void ReceiveSMSTrivialTest()
        {
            bool isRecieved = false;
            var  output     = new OutputMock();
            var  mobile     = new PhoneStub(output);

            mobile.SMSMessenger.MessageAdded += (message, isAdded) => isRecieved = true;

            mobile.ReceiveSMS(null, "");

            Assert.IsTrue(isRecieved);
        }
Ejemplo n.º 8
0
        public void ReceiveSMSTrivialTest()
        {
            bool isRecieved = false;
            var  output     = new OutputMock();
            var  mobile     = new PhoneStub(output);

            mobile.SMSProvider              = new SMSProvider();
            mobile.SMSProvider.SMSReciever += (message) => isRecieved = true;

            mobile.ReceiveSMS(null);

            Assert.IsTrue(isRecieved);
        }
Ejemplo n.º 9
0
        public void SamsungCharger_IsInProgress()
        {
            // Arrange / Act
            IOutput  output  = new OutputMock();
            ICharger charger = new SamsungCharger(output);

            charger.Charge(output);

            var expectedString = "SamsungCharger in progress\r\n";

            //Assert
            Assert.AreEqual(expectedString, output.Output.ToString());
        }
        public void ReceiveSMSTest()
        {
            string testSms  = "Some random SMS asdf;ljkqweproijsdgkhbn";
            string recieved = null;
            var    output   = new OutputMock();
            var    mobile   = new PhoneStub(output);

            mobile.SMSMessenger.MessageAdded += (message, isAdded) => recieved = message.Text;

            mobile.ReceiveSMS(testSms, null);

            Assert.AreEqual(testSms, recieved);
        }
Ejemplo n.º 11
0
        public void ConsoleFakePlay()
        {
            // Arrange / Act
            IOutput     output  = new OutputMock();
            FakeHeadset headset = new FakeHeadset(output);

            headset.Play(output);

            var expectedString = "iPhoneHeadset sound\r\n";

            //Assert
            Assert.AreEqual(expectedString, output.Output.ToString());
        }
Ejemplo n.º 12
0
        public void ChargeFastChargeTest()
        {
            var output  = new OutputMock();
            var mobile  = new PhoneStub(output);
            var charger = new FastCharger(output);

            mobile.Charge(charger);

            string chargerOutput = output.Output.ToUpper();

            Assert.IsTrue(chargerOutput.Contains("CHARGING"));
            Assert.IsTrue(chargerOutput.Contains("FAST"));
        }
        public void ChargeOrdinaryChargerTest()
        {
            var output  = new OutputMock();
            var mobile  = new PhoneStub(output);
            var charger = new OrdinaryCharger(output);

            mobile.Charge(charger);

            string chargerOutput = output.Output.ToUpper();

            Assert.IsTrue(chargerOutput.Contains("CHARGING"));
            Assert.IsTrue(chargerOutput.Contains("ORDINARY"));
        }
Ejemplo n.º 14
0
        public void PlaySamsungHeadsetTest()
        {
            var output   = new OutputMock();
            var mobile   = new PhoneStub(output);
            var playback = new SamsungHeadset(output);

            mobile.PlaybackComponent = playback;
            mobile.Play(new object());

            string playbackOutput = output.Output.ToUpper();

            Assert.IsTrue(playbackOutput.Contains("SOUND"));
            Assert.IsTrue(playbackOutput.Contains("SAMSUNG"));
        }
Ejemplo n.º 15
0
        public void PlayTest()
        {
            var output   = new OutputMock();
            var mobile   = new PhoneStub(output);
            var playback = new ExternalSpeaker(output);

            mobile.PlaybackComponent = playback;
            mobile.Play(new object());

            string playbackOutput = output.Output.ToUpper();

            Assert.IsTrue(playbackOutput.Contains("SOUND"));
            Assert.IsTrue(playbackOutput.Contains("EXTERNAL"));
        }
Ejemplo n.º 16
0
        public void ReceiveSMSTest()
        {
            string testSms  = "Some random SMS asdf;ljkqweproijsdgkhbn";
            string recieved = null;
            var    output   = new OutputMock();
            var    mobile   = new PhoneStub(output);

            mobile.SMSProvider              = new SMSProvider();
            mobile.SMSProvider.SMSReciever += (message) => recieved = message;

            mobile.ReceiveSMS(testSms);

            Assert.AreEqual(testSms, recieved);
        }
        public void PlayTest()
        {
            var output   = new OutputMock();
            var mobile   = new PhoneStub(output);
            var playback = new UnofficialIphoneHeadset(output);

            mobile.PlaybackComponent = playback;
            mobile.Play(new object());

            string playbackOutput = output.Output.ToUpper();

            Assert.IsTrue(playbackOutput.Contains("SOUND"));
            Assert.IsTrue(playbackOutput.Contains("IPHONE"));
            Assert.IsTrue(playbackOutput.Contains("UNOFFICIAL"));
        }
Ejemplo n.º 18
0
        public void MiniSim_IsCall()
        {
            // Arrange / Act
            IOutput  output  = new OutputMock();
            ISimCard simcard = new MiniSim(output);

            simcard.Call(output);

            var expectedString = "MiniSim call";
            var myOutput       = output.Output.ToString();

            //Assert
            Assert.AreNotEqual(expectedString, myOutput);
            Assert.IsTrue(myOutput.Contains(expectedString));
        }
        public void ReceiveSMSHistoryTest()
        {
            string testMessage1 = "Some random SMS asdf;ljkqweproijsdgkhbn";
            string testNumber1  = "num1";
            string testMessage2 = "Some random SMS2 asdf;ljkqweproijsdgkhbn";
            string testNumber2  = "num2";
            string testMessage3 = "Some random SMS3 asdf;ljkqweproijsdgkhbn";
            string testNumber3  = "num3";
            var    output       = new OutputMock();
            var    mobile       = new PhoneStub(output);

            mobile.ReceiveSMS(testMessage1, testNumber1);
            mobile.ReceiveSMS(testMessage2, testNumber2);
            mobile.ReceiveSMS(testMessage3, testNumber3);

            Assert.AreEqual(mobile.SMSMessenger.MessageHistory.Count, 3);
            Assert.AreEqual(mobile.SMSMessenger.MessageHistory[0].Text, testMessage1);
            Assert.AreEqual(mobile.SMSMessenger.MessageHistory[0].Number, testNumber1);
            Assert.AreEqual(mobile.SMSMessenger.MessageHistory[1].Text, testMessage2);
            Assert.AreEqual(mobile.SMSMessenger.MessageHistory[1].Number, testNumber2);
            Assert.AreEqual(mobile.SMSMessenger.MessageHistory[2].Text, testMessage3);
            Assert.AreEqual(mobile.SMSMessenger.MessageHistory[2].Number, testNumber3);
        }