예제 #1
0
        public void TryAddVehicle_AddedVehiclesToPartialyFullLot_IsTrue()
        {
            // Assign
            ParkingLot testLot = new ParkingLot();

            ParkingSlot[] testSlots     = new ParkingSlot[4];
            Vehicle[]     vehList       = new Vehicle[6];
            int           actualValue   = 0;
            int           expectedValue = 6;

            vehList[0] = new Car("A1");
            vehList[1] = new Mc("A2");
            vehList[2] = new Mc("A4");
            vehList[3] = new Trike("A5");
            vehList[4] = new Bike("A6");
            vehList[5] = new Bike("A7");
            int temp;

            // Act
            testLot.TryAddVehicle(vehList[0], out temp);
            testLot.TryAddVehicle(vehList[1], out temp);
            testLot.TryAddVehicle(vehList[2], out temp);
            testLot.TryAddVehicle(vehList[3], out temp);
            testLot.TryAddVehicle(vehList[4], out temp);
            testLot.TryAddVehicle(vehList[5], out temp);
            for (int i = 0; i < 4; i++)
            {
                testSlots[i] = (ParkingSlot)testLot.Content().GetValue(i);
            }
            // Assert
        }
예제 #2
0
        /// <summary>
        /// Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e).
        /// </summary>
        protected override void ActionPerformed(GuiButton par1GuiButton)
        {
            if (!par1GuiButton.Enabled)
            {
                return;
            }

            if (par1GuiButton.Id == 0)
            {
                Mc.DisplayGuiScreen(ParentGui);
            }
            else if (par1GuiButton.Id == 1)
            {
                SelectedSlot = SlotGeneral;
            }
            else if (par1GuiButton.Id == 3)
            {
                SelectedSlot = SlotItem;
            }
            else if (par1GuiButton.Id == 2)
            {
                SelectedSlot = SlotBlock;
            }
            else
            {
                SelectedSlot.ActionPerformed(par1GuiButton);
            }
        }
예제 #3
0
        private static String sendMessage()
        {
            var client = moceanClient();

            try
            {
                var mc1 = Mc.tgSendText().from("moceantestbot").to("813260944").content("Hello world");
                var mc2 = Mc.tgSendAudio().from("moceantestbot").to("813260944").content("https://tzhongyan.com/tt.mp3", "Hello world");
                var mc3 = Mc.tgSendAnimation().from("moceantestbot").to("813260944").content("https://i.pinimg.com/originals/0d/0a/37/0d0a3751364e58a85f68b9bf36043fdf.gif", "Hello world");
                var mc4 = Mc.tgSendDocument().from("moceantestbot").to("813260944").content("https://www.segi.edu.my/images/uploads/pdf/mbbs-2020-pdf.pdf", "Hello world");
                var mc5 = Mc.tgSendPhoto().from("moceantestbot").to("813260944").content("https://www.drupal.org/files/project-images/mocean-logo_4.jpg", "Hello world");
                var mc6 = Mc.tgSendVideo().from("moceantestbot").to("813260944").content("https://tzhongyan.com/yee.mp4", "Hello world");
                var mc7 = Mc.tgRequestContact().from("moceantestbot").to("813260944").content("Share you contact number").buttonText("Share contact");
                var mc8 = Mc.sendSMS().from("63001").to("60165465738").content("Hello world");

                var builder = (new McBuilder()).add(mc1).add(mc2).add(mc3).add(mc4).add(mc5).add(mc6).add(mc7).add(mc8);


                var res = client.Command.Execute(new CommandRequest
                {
                    mocean_command     = builder,
                    mocean_resp_format = "JSON",
                });
                return(res.ToString());
            }
            catch (NullReferenceException e)
            {
                return(e.ToString());
            }
        }
        public void PrisMcTest()
        {
            var    mc   = new Mc("d", DateTime.MinValue);
            double pris = mc.Pris();

            Assert.AreEqual(125, pris);
        }
예제 #5
0
 private void St_Kii(Soft cr, int type)
 {
     if (1 == type)//显示配置属性
     {
         if (cr.SoftName.Equals("Pilot"))
         {
             Mc.Invoke(DeviceName, 1, cr, type);
         }
         else if (cr.SoftName.Equals("Radar"))
         {
             Mc.Invoke(DeviceName, 2, cr, type);
         }
     }
     else
     {
         if (cr.SoftName == "Coach")
         {
             move_contrl = cr;
         }
         else if (null == Group.global_soft.Find(op => op.Devicename.Equals(cr.Devicename) && op.SoftName.Equals(cr.SoftName)))
         {
             move_contrl = cr;
         }
     }
 }
        /// <summary>
        /// Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e).
        /// </summary>
        protected override void ActionPerformed(GuiButton par1GuiButton)
        {
            if (!par1GuiButton.Enabled)
            {
                return;
            }

            int i = GuiGameSettings.GuiScale;

            if (par1GuiButton.Id < 100 && (par1GuiButton is GuiSmallButton))
            {
                GuiGameSettings.SetOptionValue(((GuiSmallButton)par1GuiButton).ReturnOptions(), 1);
                par1GuiButton.DisplayString = GuiGameSettings.GetKeyBinding(Options.GetOptions(par1GuiButton.Id));
            }

            if (par1GuiButton.Id == 200)
            {
                Mc.GameSettings.SaveOptions();
                Mc.DisplayGuiScreen(ParentGuiScreen);
            }

            if (GuiGameSettings.GuiScale != i)
            {
                ScaledResolution scaledresolution = new ScaledResolution(Mc.GameSettings, Mc.DisplayWidth, Mc.DisplayHeight);
                int j = scaledresolution.GetScaledWidth();
                int k = scaledresolution.GetScaledHeight();
                SetWorldAndResolution(Mc, j, k);
            }
        }
        /// <summary>
        /// Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e).
        /// </summary>
        protected override void ActionPerformed(GuiButton par1GuiButton)
        {
            if (par1GuiButton.Id == 0)
            {
                Mc.DisplayGuiScreen(new GuiOptions(this, Mc.GameSettings));
            }

            if (par1GuiButton.Id == 5)
            {
                Mc.DisplayGuiScreen(new GuiLanguage(this, Mc.GameSettings));
            }

            if (par1GuiButton.Id == 1)
            {
                Mc.DisplayGuiScreen(new GuiSelectWorld(this));
            }

            if (par1GuiButton.Id == 2)
            {
                Mc.DisplayGuiScreen(new GuiMultiplayer(this));
            }

            if (par1GuiButton.Id == 3)
            {
                Mc.DisplayGuiScreen(new GuiTexturePacks(this));
            }

            if (par1GuiButton.Id == 4)
            {
                Mc.Shutdown();
            }
        }
        /// <summary>
        /// Gets the selected world.
        /// </summary>
        public virtual void SelectWorld(int par1)
        {
            Mc.DisplayGuiScreen(null);

            if (Selected)
            {
                return;
            }

            Selected = true;
            int i = SaveList[par1].GetGameType();

            if (i == 0)
            {
                Mc.PlayerController = new PlayerControllerSP(Mc);
            }
            else
            {
                Mc.PlayerController = new PlayerControllerCreative(Mc);
            }

            string s = GetSaveFileName(par1);

            if (s == null)
            {
                s = (new StringBuilder()).Append("World").Append(par1).ToString();
            }

            Mc.StartWorld(s, GetSaveName(par1), null);
            Mc.DisplayGuiScreen(null);
        }
        public void BroBizzMcTest()
        {
            var    mc   = new Mc("f", DateTime.MaxValue);
            double pris = mc.Pris();

            Assert.AreEqual(125 * 0.95, pris);
        }
        public void TypeMcTest()
        {
            var    mc   = new Mc("e", DateTime.MaxValue);
            string type = mc.Type();

            Assert.AreEqual("mc", type);
        }
예제 #11
0
 /// <summary>
 /// Called from the main game loop to update the screen.
 /// </summary>
 public override void UpdateScreen()
 {
     if (!Mc.PlayerController.IsInCreativeMode())
     {
         Mc.DisplayGuiScreen(new GuiInventory(Mc.ThePlayer));
     }
 }
 /// <summary>
 /// Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e).
 /// </summary>
 protected override void ActionPerformed(GuiButton par1GuiButton)
 {
     if (par1GuiButton.Id == 0)
     {
         Mc.DisplayGuiScreen(new GuiMainMenu());
     }
 }
        public void OresundMcPris()
        {
            var         mc     = new Mc("i", new DateTime(2019, 2, 24));
            OersundPris pris   = new OersundPris();
            double      mcPris = pris.Pris(mc);

            Assert.AreEqual(210, mcPris);
        }
        public void TypeMcTestOersund()
        {
            var         mc          = new Mc("l", new DateTime(2019, 2, 24));
            OersundPris typeKoertøj = new OersundPris();
            string      type        = typeKoertøj.Type(mc);

            Assert.AreEqual("øresund mc", type);
        }
예제 #15
0
        public void VoiceRequestTest()
        {
            var voiceRequest = new VoiceRequest
            {
                mocean_to          = "test to",
                mocean_event_url   = "test event url",
                mocean_command     = "test mocean command",
                mocean_resp_format = "json"
            };

            Assert.IsNotNull(voiceRequest.mocean_to);
            Assert.AreEqual(voiceRequest.mocean_to, "test to");
            Assert.IsNotNull(voiceRequest.mocean_event_url);
            Assert.AreEqual(voiceRequest.mocean_event_url, "test event url");
            Assert.IsNotNull(voiceRequest.mocean_command);
            Assert.AreEqual(voiceRequest.mocean_command, "test mocean command");
            Assert.IsNotNull(voiceRequest.mocean_resp_format);
            Assert.AreEqual(voiceRequest.mocean_resp_format, "json");

            voiceRequest = new VoiceRequest();
            Assert.IsNull(voiceRequest.mocean_to);
            Assert.IsNull(voiceRequest.mocean_event_url);
            Assert.IsNull(voiceRequest.mocean_command);
            Assert.IsNull(voiceRequest.mocean_resp_format);
            voiceRequest.mocean_to = "test to";
            Assert.AreEqual(voiceRequest.mocean_to, "test to");
            voiceRequest.mocean_event_url = "test event url";
            Assert.AreEqual(voiceRequest.mocean_event_url, "test event url");
            voiceRequest.mocean_resp_format = "json";
            Assert.AreEqual(voiceRequest.mocean_resp_format, "json");

            //test multiple types of mocean_command
            var dictionaryParams = new Dictionary <string, object> {
                { "action", "say" }
            };

            voiceRequest.mocean_command = dictionaryParams;
            Assert.AreEqual(voiceRequest.mocean_command, JsonConvert.SerializeObject(new List <Dictionary <string, object> >
            {
                dictionaryParams
            }));

            voiceRequest = new VoiceRequest();
            var builderParams = (new McBuilder()).add(Mc.say("hello world"));

            voiceRequest.mocean_command = builderParams;
            Assert.IsNotNull(voiceRequest.mocean_command);
            Assert.AreEqual(JsonConvert.SerializeObject(builderParams.build()), voiceRequest.mocean_command);

            voiceRequest = new VoiceRequest();
            var mcParams = new Say {
                Text = "hello world"
            };

            voiceRequest.mocean_command = mcParams;
            Assert.IsNotNull(voiceRequest.mocean_command);
            Assert.AreEqual(JsonConvert.SerializeObject((new McBuilder()).add(mcParams).build()), voiceRequest.mocean_command);
        }
        public void TestMCNummerplade()
        {
            //Arrange
            Mc Biker = new Mc();


            //Act
            Biker.Nummerplade = "123456789";
        }
예제 #17
0
        public void McSayTest()
        {
            var say = Mc.say();

            say.Text = "testing text";
            Assert.AreEqual("testing text", say.GetRequestData()["text"]);

            Assert.AreEqual("testing text2", Mc.say("testing text2").GetRequestData()["text"]);
        }
        /// <summary>
        /// loads the saves
        /// </summary>
        private void LoadSaves()
        {
            ISaveFormat isaveformat = Mc.GetSaveLoader();

            SaveList = isaveformat.GetSaveList();
            SaveList.Sort();
            SelectedWorld = -1;
            Console.WriteLine(SaveList.Count + " is total loaded saves");
        }
예제 #19
0
        public void McSleepTest()
        {
            var sleep = Mc.sleep();

            sleep.Duration = 10000;
            Assert.AreEqual(10000, sleep.GetRequestData()["duration"]);

            Assert.AreEqual(10000, Mc.sleep(10000).GetRequestData()["duration"]);
        }
예제 #20
0
        public void McPlayTest()
        {
            var play = Mc.play();

            play.File = "testing file";
            Assert.AreEqual("testing file", play.GetRequestData()["file"]);

            Assert.AreEqual("testing file", Mc.play("testing file").GetRequestData()["file"]);
        }
예제 #21
0
        public void McDialTest()
        {
            var dial = Mc.dial();

            dial.To = "testing to";
            Assert.AreEqual("testing to", dial.GetRequestData()["to"]);

            Assert.AreEqual("testing to2", Mc.dial("testing to2").GetRequestData()["to"]);
        }
        /// <summary>
        /// Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e).
        /// </summary>
        protected override void ActionPerformed(GuiButton par1GuiButton)
        {
            if (!par1GuiButton.Enabled)
            {
                return;
            }

            if (par1GuiButton.Id == 2)
            {
                string s = ServerList[SelectedServer].Name;

                if (s != null)
                {
                    DeleteClicked = true;
                    StringTranslate stringtranslate = StringTranslate.GetInstance();
                    string          s1       = stringtranslate.TranslateKey("selectServer.deleteQuestion");
                    string          s2       = new StringBuilder().Append("'").Append(s).Append("' ").Append(stringtranslate.TranslateKey("selectServer.deleteWarning")).ToString();
                    string          s3       = stringtranslate.TranslateKey("selectServer.deleteButton");
                    string          s4       = stringtranslate.TranslateKey("gui.cancel");
                    GuiYesNo        guiyesno = new GuiYesNo(this, s1, s2, s3, s4, SelectedServer);
                    Mc.DisplayGuiScreen(guiyesno);
                }
            }
            else if (par1GuiButton.Id == 1)
            {
                JoinServer(SelectedServer);
            }
            else if (par1GuiButton.Id == 4)
            {
                DirectClicked = true;
                Mc.DisplayGuiScreen(new GuiScreenServerList(this, TempServer = new ServerNBTStorage(StatCollector.TranslateToLocal("selectServer.defaultName"), "")));
            }
            else if (par1GuiButton.Id == 3)
            {
                AddClicked = true;
                Mc.DisplayGuiScreen(new GuiScreenAddServer(this, TempServer = new ServerNBTStorage(StatCollector.TranslateToLocal("selectServer.defaultName"), "")));
            }
            else if (par1GuiButton.Id == 7)
            {
                EditClicked = true;
                ServerNBTStorage servernbtstorage = (ServerNBTStorage)ServerList[SelectedServer];
                Mc.DisplayGuiScreen(new GuiScreenAddServer(this, TempServer = new ServerNBTStorage(servernbtstorage.Name, servernbtstorage.Host)));
            }
            else if (par1GuiButton.Id == 0)
            {
                Mc.DisplayGuiScreen(ParentScreen);
            }
            else if (par1GuiButton.Id == 8)
            {
                Mc.DisplayGuiScreen(new GuiMultiplayer(ParentScreen));
            }
            else
            {
                ServerSlotContainer.ActionPerformed(par1GuiButton);
            }
        }
예제 #23
0
        ///<summary>
        /// Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e).
        ///</summary>
        protected new void ActionPerformed(GuiButton par1GuiButton)
        {
            if (par1GuiButton.Id == 1)
            {
                Mc.DisplayGuiScreen(null);
                Mc.SetIngameFocus();
            }

            base.ActionPerformed(par1GuiButton);
        }
        public void MCPris()
        {
            //Arange
            var MC = new Mc();
            //Act
            decimal pris = MC.Pris();

            //Assert
            Assert.AreEqual(125, pris);
        }
        public void MCPrisMedBrobizz()
        {
            //Arange
            var MC = new Mc();
            //Act
            decimal pris = MC.BrobizzPris();

            //Assert
            Assert.AreEqual(118.75m, pris);
        }
        public void MCKøretøj()
        {
            //Arange
            var MC = new Mc();
            //Act
            string køretøj = MC.Køretøj();

            //Assert
            Assert.AreEqual("MC", køretøj);
        }
예제 #27
0
 private void TitleButtonClick(object sender, EventArgs e)
 {
     if (CloseComputerLabel.Equals(sender))//主机设置
     {
         Mc.Invoke(DeviceName, 0, null, 0);
     }
     else//开机
     {
     }
 }
예제 #28
0
파일: Monik.cs 프로젝트: Totopolis/monik
        public void MergeFrom(Event other)
        {
            if (other == null)
            {
                return;
            }
            if (other.Created != 0L)
            {
                Created = other.Created;
            }
            if (other.Source.Length != 0)
            {
                Source = other.Source;
            }
            if (other.Instance.Length != 0)
            {
                Instance = other.Instance;
            }
            switch (other.MsgCase)
            {
            case MsgOneofCase.Ka:
                if (Ka == null)
                {
                    Ka = new global::Monik.Common.KeepAlive();
                }
                Ka.MergeFrom(other.Ka);
                break;

            case MsgOneofCase.Lg:
                if (Lg == null)
                {
                    Lg = new global::Monik.Common.Log();
                }
                Lg.MergeFrom(other.Lg);
                break;

            case MsgOneofCase.Pc:
                if (Pc == null)
                {
                    Pc = new global::Monik.Common.PerfCounter();
                }
                Pc.MergeFrom(other.Pc);
                break;

            case MsgOneofCase.Mc:
                if (Mc == null)
                {
                    Mc = new global::Monik.Common.Metric();
                }
                Mc.MergeFrom(other.Mc);
                break;
            }

            _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
        }
예제 #29
0
        /// <summary>
        /// Called when the screen is unloaded. Used to disable keyboard repeat events
        /// </summary>
        public override void OnGuiClosed()
        {
            //Keyboard.enableRepeatEvents(false);

            if (Mc.TheWorld.IsRemote)
            {
                Mc.GetSendQueue().AddToSendQueue(new Packet130UpdateSign(EntitySign.XCoord, EntitySign.YCoord, EntitySign.ZCoord, EntitySign.SignText));
            }

            EntitySign.Func_50006_a(true);
        }
예제 #30
0
        public void Mc_Size_Is2()
        {
            // Assign
            int     expectedValue = 2;
            Vehicle veh           = new Mc("");
            // Act
            int actualValue = veh.Size;

            // Assert
            Assert.AreEqual(expectedValue, actualValue);
        }