static void Main(string[] args) { TV tv1 = new TV(); tv1.Identificador = "TV1"; LigarTV(tv1); DesligarTV(tv1); Console.ReadKey(); }
public void BasicRemote_Case_Power() { IDevice device = new TV(102, 2); var basicRemote = new BasicRemote(device); basicRemote.Power(); Assert.True(device.IsEnabled()); }
public TV BuildCheapTV() { var cheapTB = new TV(); cheapTB.ControlBoard = new CheapBoard(); cheapTB.DisplayMatrix = new CheapMatrix(); cheapTB.Remote = new SmallRemote(); return cheapTB; }
public TV BuildDeluxeTV() { var deluxeTV = new TV(); deluxeTV.ControlBoard = new DeluxeBoard(); deluxeTV.DisplayMatrix = new DeluxeMatrix(); deluxeTV.Remote = new BigRemote(); return deluxeTV; }
private void CommandStart(object sender, RoutedEventArgs e) { Pult pult = new Pult(); TV tv = new TV(); pult.SetCommand(new TVOnCommand(tv)); MessageBox.Show(pult.PressButton()); MessageBox.Show(pult.PressUndo()); }
public void BasicRemote_Case_VolumeDown() { IDevice device = new TV(20, 11); var basicRemote = new BasicRemote(device); basicRemote.VolumeDown(); Assert.Equal(10, device.GetVolume()); }
// Use this for initialization void Start() { journalAnim.SetBool("Show", false); isActive = false; tvScript = tvGO.GetComponent <TV> (); evtScript = evtGO.GetComponent <EventController> (); playerScript = player.GetComponent <Player> (); }
public void TestForTvChannalUp() { var tv = new TV(); var remote = new Remote(tv); var actual = remote.ChannalUp(); var expected = 2; Assert.AreEqual(expected, actual); }
public async Task <ValidationResult> ValidateRequest <T, TV>() where T : AServiceRequest where TV : AbstractValidator <T>, new() { var validator = new TV(); var requestObject = await GetRequestObject <T>(); return(await validator.ValidateAsync(requestObject)); }
public void TestForExtendedAdvancedRemoteMute() { var tv = new TV(); var remote = new ExtendedAdvancedRemote(tv); var actual = remote.Mute(); var expected = 0; Assert.AreEqual(expected, actual); }
public void TestForTvChangeVolume3() { var tv = new TV(); var remote = new Remote(tv); var actual = remote.ChangeVolume(-10); var expected = 0; Assert.AreEqual(expected, actual); }
public void BasicRemote_Case_ChannelDown() { IDevice tv = new TV(20, 70); var basicRemote = new BasicRemote(tv); basicRemote.ChannelDown(); Assert.Equal(69, tv.GetChannel()); }
public void BasicRemote_Case_ChannelUpChannel100() { IDevice device = new TV(20, 100); var basicRemote = new BasicRemote(device); basicRemote.ChannelUp(); Assert.Equal(100, device.GetChannel()); }
public void BasicRemote_Case_ChannelDownChannel1() { IDevice tv = new TV(10, 1); var basicRemoteTv = new BasicRemote(tv); basicRemoteTv.ChannelDown(); Assert.Equal(1, tv.GetChannel()); }
public Builder Put(T key, TV value) { if (!keysOrder.Contains(key)) { keysOrder.Add(key); } dictionary.Put(key, value); return(this); }
/// <summary> /// Puts value at given key into builder dictionary. /// </summary> /// <param name="key">Key</param> /// <param name="value">Value</param> /// <returns>Builder instance</returns> public OrderedHashImmutableDictionaryBuilder Put(T key, TV value) { if (!keysOrder.Contains(key)) { keysOrder.Add(key); } dictionary.Put(key, value); return(this); }
public void Draw(SpriteBatch spriteBatch) { foreach (T TV in Objects.ToArray()) { if (TV != null) { TV.Draw(spriteBatch); } } }
public void TV_Case_Disable() { var tv = new TV(45, 25); tv.Enable(); tv.Disable(); Assert.False(tv.On); }
public void TV_Case_IsEnabled() { var tv = new TV(10, 15); tv.Enable(); bool isEnabled = tv.IsEnabled(); Assert.True(isEnabled); }
private void TreeViewBrowse_Click(object sender, RoutedEventArgs e) { var item = TV.GetSelectedTag <TreeItem>(); if (item != null) { WpfExtensions.Browse(item.Url); return; } }
private void TV_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e) { PG.SelectedObject = e.NewValue; var login = TV.GetSelectedTag <Model.Login>(); if (login != null) { Login(login.Parent); } }
public virtual void Execute(TV executor) { if (!executed) { executed = true; this.executor = executor; Destroy(model.gameObject); audioSource.Play(); } }
public TV BuildCheapTV() { var cheapTB = new TV(); cheapTB.ControlBoard = new CheapBoard(); cheapTB.DisplayMatrix = new CheapMatrix(); cheapTB.Remote = new SmallRemote(); return(cheapTB); }
public void TVOffAreEqual() { string constResult = "Телевизор выключен"; TV tv = new TV(); string result; result = tv.Off(); Assert.AreEqual(constResult, result); }
public void ModificarArticuloInexistenteDeLaBD_test() { bool ret = false; TV tv1 = new TV(1, "Tv philco", "Philco", EEstado.Nuevo, 22, 20000); if (tv1.ModificarArticuloEnBD("Tv Samsung")) { ret = true; } }
public TV BuildDeluxeTV() { var deluxeTV = new TV(); deluxeTV.ControlBoard = new DeluxeBoard(); deluxeTV.DisplayMatrix = new DeluxeMatrix(); deluxeTV.Remote = new BigRemote(); return(deluxeTV); }
static void Main(string[] args) { TVRemoteManager remote1 = new TVRemoteManager(); TV sonyTv = new TV(); remote1.setCommand(new TvOnComand(sonyTv)); remote1.Invoke(); remote1.setCommand(new TvOffCommand(sonyTv)); remote1.Invoke(); }
public void TVOnCommandUndoAreEqual() { string constResult = "Телевизор выключен"; TV tv = new TV(); ICommand command = new TVOnCommand(tv); string result; result = command.Undo(); Assert.AreEqual(constResult, result); }
static void Main(String[] args) { Console.WriteLine("Programadores: Andrew de Oliveira Duchini\n\tCristóvão Olegário\n\n"); TV tv = new TV(); tv.ligar(); tv.aumentar_volume(); tv.diminuir_volume(); tv.desligar(); Console.ReadKey(); }
public void Run() { Radio ro = new Radio(); TV tv = new TV(); Remote r = new Remote(ro); r.SetChannel(5); r.SetVolume(1); r.SetVolume(19); }
public void TV_Case_NewTV() { int volume = 5; int channel = 10; var tv = new TV(volume, channel); Assert.False(tv.On); Assert.Equal(volume, tv.Volume); Assert.Equal(channel, tv.Channel); }
public PartialViewResult Add(string catchhall) { var catchs = catchhall.Split('/'); Device newDevice; if (!String.IsNullOrEmpty(catchs[0])) { using (DeviceContext db = new DeviceContext()) { switch (catchs[0]) { case "light": newDevice = new Light("Лампа", new Modeslvl(new string[] { "низкий", "средний", "высокий", "макс." })); db.Devices.Add(newDevice); db.SaveChanges(); return(PartialView("PartLight", newDevice)); case "tv": newDevice = new TV("TV", new Modeslvl(new string[] { "низкий", "средний", "высокий", "макс." }), new Volume100(), new Channel100()); db.Devices.Add(newDevice); db.SaveChanges(); return(PartialView("PartTV", newDevice)); case "cond": newDevice = new Conditioner("Cond", new Termostat()); db.Devices.Add(newDevice); db.SaveChanges(); return(PartialView("PartCond", newDevice)); case "ref": newDevice = new Refrigerator("Ref", new Modeslvl(new string[] { "эконом.", "авто", "интенс." }), new RefTemp(), new RefrigeratorSpace(50)); db.Devices.Add(newDevice); db.SaveChanges(); return(PartialView("PartRef", newDevice)); case "ref_add": return(PartialView("PartRefItem", new int[] { Convert.ToInt32(catchs[1]), Convert.ToInt32(catchs[2]) })); case "micr": newDevice = new Microwave("Micr", new Modeslvl((new string[] { "разморозка", "низкий", "средний", "макс" })), new NetTimer()); db.Devices.Add(newDevice); db.SaveChanges(); return(PartialView("PartMicrowave", newDevice)); default: throw new Exception("Bad Request"); } } } else { throw new Exception("Bad Request"); } }
public static void Main() { Pult pult = new Pult(); TV tv = new TV(); pult.SetCommand(new TVOnCommand(tv)); pult.PressButton(); pult.PressUndo(); Console.ReadKey(); }
public void insert(TV tv) { grabbable.overrideInteractability(false); body.isKinematic = true; body.useGravity = false; transform.parent = null; insertState = 1; insertTime = Time.time; insertPos = transform.position; insertRot = transform.rotation; insertTV = tv; targetPos = tv.transform.TransformPoint(new Vector3(0, 0.6f, 1.81f)); targetRot = tv.transform.rotation * Quaternion.Euler(180, 0, 0); }
public void win(TV tv) { // Increment the level progress if we're in a wing if (levelType != LevelType.Other && levelNumber > LEVEL_PROGRESS[(int) levelType]) LEVEL_PROGRESS[(int) levelType] = levelNumber; // If we just beat a Green Wing level, beat all Red Wing levels // If we just beat a Blue Wing level, beat all Red and Green Wing levels // This is entirely so that the progression works within the editor if (levelType == LevelType.GreenWing || levelType == LevelType.BlueWing) { LEVEL_PROGRESS[0] = LEVEL_COUNT[0]; GAME_PROGRESS[0] = 2; } if (levelType == LevelType.BlueWing) { LEVEL_PROGRESS[1] = LEVEL_COUNT[1]; GAME_PROGRESS[1] = 2; } // Exiting level logic state = GameState.ExitingLevel; stateTime = 0; stateAudio[4].Play(); playerCamera.transform.parent = tv.transform; exitingPos = playerCamera.transform.localPosition; exitingVelocity = tv.transform.InverseTransformVector(player.getPhysicalVelocity() * Time.fixedDeltaTime); exitingVelocity2 = player.getPhysicalVelocity() * Time.fixedDeltaTime; exitingAngularVelocity = player.getAngularVelocity(); exitingRot = playerCamera.transform.localRotation; exitingScene = tv.nextScene; player.gameObject.SetActive(false); // As long as we're not going to the finale or currently in it, just save the game normally if (exitingScene != "Finale" && finale == null) saveGame(tv.nextScene); // If we are in the finale, save the game (still going back to the hub) with the flag that we've completed it if (finale != null) { if (!GAME_COMPLETE) { GAME_COMPLETE = true; saveGame("Hub"); } } }
/// <summary> /// Creates the TV. /// </summary> /// <param name="transform">The transform.</param> /// <returns>The created TV</returns> public static TV CreateTV(Transform transform) { TV tv = new TV(transform, lastTVId++); tvs.Add(tv); return tv; }
static void LigarTV(TV tv) { Console.WriteLine("A TV {0} foi ligada", tv.Identificador); }
public void Start() { while (true) { Console.Clear(); if (devices.Count == 0) { Console.WriteLine("You have no devices yet"); } else { foreach (var device in devices) { Console.WriteLine("Name: " + device.Key + "\n" + device.Value); } } Console.WriteLine(); Console.WriteLine("Type in the command or press <Enter> for help: "); string[] commands = Console.ReadLine().ToLower().Split(' '); if (commands.Length != 3 && commands.Length != 2 & commands.Length != 1) { Help(); continue; } switch (commands[0]) { case "add": if (commands.Length != 3) { Help(); continue; } if (!devices.ContainsKey(commands[2])) { if (commands[1] == "fridge") { Fridge f = new Fridge(); devices.Add(commands[2], f); } else if (commands[1] == "garage") { Garage g = new Garage(); devices.Add(commands[2], g); } else if (commands[1] == "camera") { Camera c = new Camera(); devices.Add(commands[2], c); } else if (commands[1] == "airconditioner") { AirConditioner a = new AirConditioner(); devices.Add(commands[2], a); } else if (commands[1] == "tv") { TV t = new TV(); devices.Add(commands[2], t); } else if (commands[1] == "panasonicstereo") { PanasonicStereoSystem p = new PanasonicStereoSystem(new PanasonicLoudspeakers()); devices.Add(commands[2], p); } else if (commands[1] == "panasonicspeakers") { PanasonicLoudspeakers pl = new PanasonicLoudspeakers(); devices.Add(commands[2], pl); } else { Console.WriteLine(commands[1] + " is not a device. " + "Press <Enter> to continue"); Console.ReadLine(); Help(); continue; } } else { Console.WriteLine("Device with name \'{0}\' already exists. " + "Press <Enter> to continue", commands[2]); Console.ReadLine(); } break; case "del": if (commands.Length != 2) { Help(); continue; } if (commands[1] == "all") { devices.Clear(); Console.WriteLine("All devices was removed"); } if (isValid(commands[1]) && commands[1] != "all") { devices.Remove(commands[1]); } break; case "on": if (commands.Length != 2) { Help(); continue; } if (commands[1] == "all") { foreach (var device in devices) { device.Value.On(); } } if (isValid(commands[1]) && commands[1] != "all") { devices[commands[1]].On(); } break; case "off": if (commands.Length != 2) { Help(); continue; } if (commands[1] == "all") { foreach (var device in devices) { device.Value.Off(); } } if (isValid(commands[1]) && commands[1] != "all") { devices[commands[1]].On(); } break; case "open": if (commands.Length != 2) { Help(); continue; } if (commands[1] == "all") { foreach (var device in devices) { if (device.Value is IOpenable) { (device.Value as IOpenable).Open(); } } } if (isValid(commands[1]) && commands[1] != "all") { if (devices[commands[1]] is IOpenable) { (devices[commands[1]] as IOpenable).Open(); } else { Console.WriteLine("You can't apply command \'open\' to {0} {1}. " + "Press <Enter> to continue", devices[commands[1]].GetType().Name, commands[1]); Console.ReadLine(); } } break; case "close": if (commands.Length != 2) { Help(); continue; } if (commands[1] == "all") { foreach (var device in devices) { if (device.Value is IOpenable) { (device.Value as IOpenable).Close(); } } } if (isValid(commands[1]) && commands[1] != "all") { if (devices[commands[1]] is IOpenable) { (devices[commands[1]] as IOpenable).Close(); } else { Console.WriteLine("You can't apply command \'close\' to {0} {1}. " + "Press <Enter> to continue", devices[commands[1]].GetType().Name, commands[1]); Console.ReadLine(); } } break; case "addvolume": if (commands.Length != 2) { Help(); continue; } if (commands[1] == "all") { foreach (var device in devices) { if (device.Value is IVolumeable) { (device.Value as IVolumeable).AddVolume(); } } } if (isValid(commands[1]) && commands[1] != "all") { if (devices[commands[1]] is IVolumeable) { (devices[commands[1]] as IVolumeable).AddVolume(); } else { Console.WriteLine("You can't apply command \'addvolume\' to {0} {1}. " + "Press <Enter> to continue", devices[commands[1]].GetType().Name, commands[1]); Console.ReadLine(); } } break; case "decvolume": if (commands.Length != 2) { Help(); continue; } if (commands[1] == "all") { foreach (var device in devices) { if (device.Value is IVolumeable) { (device.Value as IVolumeable).DecreaseVolume(); } } } if (isValid(commands[1]) && commands[1] != "all") { if (devices[commands[1]] is IVolumeable) { (devices[commands[1]] as IVolumeable).DecreaseVolume(); } else { Console.WriteLine("You can't apply command \'decvolume\' to {0} {1}. " + "Press <Enter> to continue", devices[commands[1]].GetType().Name, commands[1]); Console.ReadLine(); } } break; case "mute": if (commands.Length != 2) { Help(); continue; } if (commands[1] == "all") { foreach (var device in devices) { if (device.Value is IVolumeable) { (device.Value as IVolumeable).Mute(); } } } if (isValid(commands[1]) && commands[1] != "all") { if (devices[commands[1]] is IVolumeable) { (devices[commands[1]] as IVolumeable).Mute(); } else { Console.WriteLine("You can't apply command \'mute\' to {0} {1}. " + "Press <Enter> to continue", devices[commands[1]].GetType().Name, commands[1]); Console.ReadLine(); } } break; case "startrec": if (commands.Length != 2) { Help(); continue; } if (commands[1] == "all") { foreach (var device in devices) { if (device.Value is IRecording) { (device.Value as IRecording).StartRecording(); } } } if (isValid(commands[1]) && commands[1] != "all") { if (devices[commands[1]] is IRecording) { (devices[commands[1]] as IRecording).StartRecording(); } else { Console.WriteLine("You can't apply command \'startrec\' to {0} {1}. " + "Press <Enter> to continue", devices[commands[1]].GetType().Name, commands[1]); Console.ReadLine(); } } break; case "stoprec": if (commands.Length != 2) { Help(); continue; } if (commands[1] == "all") { foreach (var device in devices) { if (device.Value is IRecording) { (device.Value as IRecording).StopRecording(); } } } if (isValid(commands[1]) && commands[1] != "all") { if (devices[commands[1]] is IRecording) { (devices[commands[1]] as IRecording).StopRecording(); } else { Console.WriteLine("You can't apply command \'stoprec\' to {0} {1}. " + "Press <Enter> to continue", devices[commands[1]].GetType().Name, commands[1]); Console.ReadLine(); } } break; case "addtemp": if (commands.Length != 2) { Help(); continue; } if (commands[1] == "all") { foreach (var device in devices) { if (device.Value is ITemperature) { (device.Value as ITemperature).AddTemperture(); } } } if (isValid(commands[1]) && commands[1] != "all") { if (devices[commands[1]] is ITemperature) { (devices[commands[1]] as ITemperature).AddTemperture(); } else { Console.WriteLine("You can't apply command \'addtemp\' to {0} {1}. " + "Press <Enter> to continue", devices[commands[1]].GetType().Name, commands[1]); Console.ReadLine(); } } break; case "dectemp": if (commands.Length != 2) { Help(); continue; } if (commands[1] == "all") { foreach (var device in devices) { if (device.Value is ITemperature) { (device.Value as ITemperature).DecreaseTemperature(); } } } if (isValid(commands[1]) && commands[1] != "all") { if (devices[commands[1]] is ITemperature) { (devices[commands[1]] as ITemperature).DecreaseTemperature(); } else { Console.WriteLine("You can't apply command \'dectemp\' to {0} {1}. " + "Press <Enter> to continue", devices[commands[1]].GetType().Name, commands[1]); Console.ReadLine(); } } break; case "addbass": if (commands.Length != 2) { Help(); continue; } if (commands[1] == "all") { foreach (var device in devices) { if (device.Value is IBass) { (device.Value as IBass).BassOn(); } } } if (isValid(commands[1]) && commands[1] != "all") { if (devices[commands[1]] is IBass) { (devices[commands[1]] as IBass).BassOn(); } else { Console.WriteLine("You can't apply command \'addbass\' to {0} {1}. " + "Press <Enter> to continue", devices[commands[1]].GetType().Name, commands[1]); Console.ReadLine(); } } break; case "delbass": if (commands.Length != 2) { Help(); continue; } if (commands[1] == "all") { foreach (var device in devices) { if (device.Value is IBass) { (device.Value as IBass).BassOff(); } } } if (isValid(commands[1]) && commands[1] != "all") { if (devices[commands[1]] is IBass) { (devices[commands[1]] as IBass).BassOff(); } else { Console.WriteLine("You can't apply command \'delbass\' to {0} {1}. " + "Press <Enter> to continue", devices[commands[1]].GetType().Name, commands[1]); Console.ReadLine(); } } break; case "exit": if (commands.Length != 1) { Help(); } return; default: Help(); continue; break; } } }