public IHttpActionResult PostClient1(Client1 client1) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Clients1.Add(client1); try { db.SaveChanges(); } catch (DbUpdateException) { if (Client1Exists(client1.ClientID)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = client1.ClientID }, client1)); }
internal void SimpleCallTest(int length) { for (int i = 0; i < length; i++) { Client1.Call <ITestInterface>(Client2.Id).SimpleMethod(a, b, c); } }
internal void VariableCallTest(int length) { for (int i = 0; i < length; i++) { Client1.Call <ITestInterface>(Client2.Id).VariableParametersTest(new object[] { a, b, c }); } }
public IHttpActionResult PutClient1(int id, Client1 client1) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != client1.ClientID) { return(BadRequest()); } db.Entry(client1).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!Client1Exists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
static void Main(string[] args) { try { SquareMatrix<int> squareMatrix1 = new SquareMatrix<int>(new int[,] { { 1, 2 }, { 3, 4 } }); SquareMatrix<int> squareMatrix2 = new SquareMatrix<int>(new int[,] { { 1, 2 }, { 3, 4 } }); //SquareMatrix<int> squareMatrix2 = new SquareMatrix<int>(new int[,]{{1,2,3},{4,5,6}}); SymmetricalMatrix<int> symmetricalMatrix1 = new SymmetricalMatrix<int>((new int[,] { { 1, 1 }, { 1, 4 } })); //SymmetricalMatrix<int> symmetricalMatrix2 = new SymmetricalMatrix<int>((new int[,] { { 1, 2 }, { 1, 4 } })); SquareMatrix<int> squareMatrix3 = new SymmetricalMatrix<int>((new int[,] { { 1, 1 }, { 1, 4 } })); SymmetricalMatrix<int> symmetricalMatrix3 = (SymmetricalMatrix<int>)squareMatrix3; DiagonalMatrix<int> diagonalMatrix1 = new DiagonalMatrix<int>(new int[,] { { 1, 0 }, { 0, 1 } }); var client = new Client1<int>(squareMatrix1); var client2 = new Client1<int>(symmetricalMatrix1); squareMatrix1[0, 0] = 2; symmetricalMatrix1[1, 0] = 2; Console.ReadKey(); } catch (Exception e) { Console.WriteLine(e.Message); Console.ReadKey(); } }
static void Main(string[] args) { //手动实现迭代器 Object[] values = { "a", "b", "c", "d", "e" }; IterationSample collection = new IterationSample(values, 3); foreach (var x in collection) { Console.WriteLine(x); } Console.WriteLine(); //Example1 Client1 client1 = new Client1(); client1.Operation(); Console.WriteLine(); //Example2 Client2 client2 = new Client2(); client2.Operation(); Console.ReadKey(); }
internal void AsyncTimeoutResultCallTest() { ManualResetEvent eventa = new ManualResetEvent(false); DateTime start = DateTime.Now; AsyncCallResultDelegate delegateInstance = delegate(ISuperPoolClient client, AsyncResultParams parameters) { TimeSpan time = DateTime.Now - start; Console.WriteLine("Async call result received in " + time.TotalMilliseconds + "ms."); eventa.Set(); string p = parameters.Result as string; }; Client1.CallAll <ITestInterface>(delegateInstance, 152, TimeSpan.FromSeconds(2)).AsyncResultMethod(500); eventa.WaitOne(60000); if (Client1.PendingSyncCallsCount != 1) { throw new Exception("Pending sync calls count not 1."); } // Allow time for the client GC to gather the call. Thread.Sleep(SuperPoolClient.GarbageCollectorIntervalMs * 3); if (Client1.PendingSyncCallsCount != 0) { throw new Exception("Pending sync calls count not 0."); } }
internal void AsyncResultCallTest() { ManualResetEvent eventa = new ManualResetEvent(false); AsyncCallResultDelegate delegateInstance = delegate(ISuperPoolClient client, AsyncResultParams parameters) { if ((parameters.State is int == false) || (int)parameters.State != 152) { Assert.Fail("Parameter fail."); } if (parameters.Result != null) { // Do something with result. string resultString = parameters.Result.ToString(); } eventa.Set(); }; Client1.Call <ITestInterface>(Client2.Id, delegateInstance, 152).AsyncResultMethod(1500); if (eventa.WaitOne(60000) == false) { Assert.Fail("Failed to receive async result."); } }
private void A1_Tick(object sender, EventArgs e) { PS3.Extension.WriteString(0x004eb39c, "^5S^7pec Ops ^5M^7od Menu ^5B^7y ^5M^7rNiato - ^5M^7ain ^5M^7enu\n\n^2-->^5Host Menu\nClient 1 Menu\nReset Menu\nAccount Menu\nTeleport Menu\nVision Menu\nCredit Menu\n\n\n^3Client 0 : ^2" + textBox1.Text + "\n^3Client 1 : ^2" + textBox2.Text + "^5"); if (Key_IsDown((uint)0) == "X") { HostMenuMain.Stop(); B1.Start(); } if (Key_IsDown((uint)0) == "R1") { HostMenuMain.Stop(); Client1.Start(); } if (Key_IsDown((uint)0) == "R3 + L3") { HostMenuMain.Stop(); B1.Stop(); B2.Stop(); B3.Stop(); B4.Stop(); B5.Stop(); Client1.Stop(); C1.Stop(); C2.Stop(); C3.Stop(); C4.Stop(); ResetMenu.Stop(); D1.Stop(); D2.Stop(); D3.Stop(); D4.Stop(); D5.Stop(); AccountMenu.Stop(); E1.Stop(); E2.Stop(); E3.Stop(); E4.Stop(); E5.Stop(); TeleportMenu.Stop(); F1.Stop(); F2.Stop(); F3.Stop(); F4.Stop(); VisionMenu.Stop(); G1.Stop(); G2.Stop(); G3.Stop(); G4.Stop(); G5.Stop(); G6.Stop(); OtherMenu.Stop(); H1.Stop(); PS3.Extension.WriteString(0x004eb39c, "^5Menu ^1Closed"); simpleButton2.Enabled = true; toolStripStatusLabel2.Text = "Not Started !"; toolStripStatusLabel2.ForeColor = Color.Red; simpleButton3.Enabled = false; } }
// Use this for initialization void Start() { IClient client = new Client1(); IFunction function = new Function2(); client.SetFunction(function); function.SetClient(client); client.mStr = "xxxx"; client.Call(); }
public void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Debug.Log("Instance already exists, destroying object!"); } }
public IHttpActionResult GetClient1(int id) { Client1 client1 = db.Clients1.FirstOrDefault(b => b.ClientID == id); if (client1 == null) { return(NotFound()); } return(Ok(client1)); }
internal void DirectCallTest(int length) { ITestInterface result = null; for (int i = 0; i < length; i++) { result = Client1.CallDirectLocal <ITestInterface>(Client2.Id).DirectCall("some data"); } Assert.AreEqual(result == Client2.Source, true, "Result failed."); }
internal void OutCallTest() { try { int d = 0; Client1.Call <ITestInterface>(Client2.Id).OutMethod(out d); throw new Exception("Invalid call did not generate expected exception."); } catch (NotImplementedException) { // Test succeded only if exception is thrown. } }
static void Main(string[] args) { IUnityContainer container = new UnityContainer(); container.RegisterType <IFoo, Foo1>("Foo1"); container.RegisterType <IFoo, Foo2>("Foo2"); container.RegisterType <Client1>(new InjectionConstructor(new ResolvedParameter <IFoo>("Foo1"))); container.RegisterType <Client2>(new InjectionConstructor(new ResolvedParameter <IFoo>("Foo2"))); Client1 client1 = container.Resolve <Client1>(); Client2 client2 = container.Resolve <Client2>(); }
public void FailureTest1([Values(1)] int serverIndex) { if (_nServers < 2) { Assert.Ignore("Only test for >=2 servers."); return; } _serverList[serverIndex].DisposeChannel(); Client1.Write(Tuple1); var result = Client1.Read(Tuple1); Assert.AreEqual(Tuple1, result); }
public IHttpActionResult DeleteClient1(int id) { Client1 client1 = db.Clients1.Find(id); if (client1 == null) { return(NotFound()); } db.Clients1.Remove(client1); db.SaveChanges(); return(Ok(client1)); }
public void FailureTest2([Values(0)] int serverIndex) { if (_nServers < 2) { Assert.Ignore("Only test for >=2 servers."); return; } _serverList[serverIndex].DisposeChannel(); _serverList.RemoveAt(serverIndex); //_serverList[0].SetView(new View(_serverList.ConvertAll(input => input.EndpointURL), 1)); Client1.Write(Tuple1); var result = Client1.Read(Tuple1); Assert.AreEqual(Tuple1, result); }
static void Main() { HRTimer.HiResTimer hrt = new HRTimer.HiResTimer(); hrt.Start(); Client client = new Client(); CommChannelDemo.Message msg = client.makeMessage("Sahil Shah", client.endPoint, client.endPoint); CommChannelDemo.Message msg1 = client.makeMessage("Rishi Dabre", client.endPoint, client.endPoint); string remoteEndPoint = Comm <Client> .makeEndPoint("http://localhost", 8080); msg.body = MessageTest.makeTestRequest(); msg.to = remoteEndPoint; msg1.body = MessageTest.makeAnotherTestRequest(); msg1.to = remoteEndPoint; client.comm.sndr.PostMessage(msg); client.comm.sndr.PostMessage(msg1); Console.Write("\n"); Console.Write("\n"); Console.Write(" ================================================================================================\n"); Console.Write("\n CLIENT WINDOW\n"); Console.Write("\n ================================================================================================\n"); Console.Write("\n\n Client Sending Files to Repository for the test request---------------->Requirement #2"); Console.Write("\n =======================================================\n"); Client1 clnt = new Client1(); clnt.channel = CreateServiceChannel("http://*****:*****@"../../../Service/DLL/logfile.txt"); System.Console.WriteLine("{0}", text); hrt.Stop(); Console.Write("\n\n total elapsed time for Entire Execution = {0} micro seconds------>Requirement #12.\n", hrt.ElapsedMicroseconds); ((IChannel)clnt.channel).Close(); }
private void simpleButton3_Click(object sender, EventArgs e) { MainMenu.Stop(); HostMenuMain.Stop(); B1.Stop(); B2.Stop(); B3.Stop(); B4.Stop(); B5.Stop(); Client1.Stop(); C1.Stop(); C2.Stop(); C3.Stop(); C4.Stop(); ResetMenu.Stop(); D1.Stop(); D2.Stop(); D3.Stop(); D4.Stop(); D5.Stop(); AccountMenu.Stop(); E1.Stop(); E2.Stop(); E3.Stop(); E4.Stop(); E5.Stop(); TeleportMenu.Stop(); F1.Stop(); F2.Stop(); F3.Stop(); F4.Stop(); VisionMenu.Stop(); G1.Stop(); G2.Stop(); G3.Stop(); G4.Stop(); G5.Stop(); G6.Stop(); OtherMenu.Stop(); H1.Stop(); PS3.Extension.WriteString(0x004eb39c, "^5Menu ^1Closed"); toolStripStatusLabel2.Text = "Not Started !"; toolStripStatusLabel2.ForeColor = Color.Red; simpleButton2.Enabled = true; simpleButton3.Enabled = false; }
private void Client1_Tick(object sender, EventArgs e) { PS3.Extension.WriteString(0x004eb39c, "^5S^7pec Ops ^5M^7od Menu ^5B^7y ^5M^7rNiato - ^5M^7ain ^5M^7enu\n\n^5Host Menu\n^2-->^5Client 1 Menu\nReset Menu\nAccount Menu\nTeleport Menu\nVision Menu\nCredit Menu\n\n\n^3Client 0 : ^2" + textBox1.Text + "\n^3Client 1 : ^2" + textBox2.Text + "^5"); if (Key_IsDown((uint)0) == "X") { Client1.Stop(); C1.Start(); } if (Key_IsDown((uint)0) == "R1") { Client1.Stop(); ResetMenu.Start(); } if (Key_IsDown((uint)0) == "L1") { Client1.Stop(); HostMenuMain.Start(); } }
static void Main(string[] args) { var audi = new AUDIFactory(); Conveyor(audi); var bmw = new BMWFactory(); Conveyor(bmw); var audi_car = new AUDIFactory(); var c1 = new Client1(audi_car); c1.makePhoto(); c1.goRepair(); Console.Read(); }
internal void ConfirmedCallTest() { CallOutcome outcome; Client1.CallConfirmed <ITestInterface>(Client2.Id, TimeSpan.FromSeconds(2), out outcome).SimpleMethod(2, "some param", EventArgs.Empty); if (outcome == null || outcome.Result != Outcomes.Success) { Assert.Fail("Failed to perform confirmed call."); } ClientId dummyId = new ClientId("dummyId"); CallOutcome outcome2; Client1.CallConfirmed <ITestInterface>(dummyId, TimeSpan.FromSeconds(2), out outcome2).SimpleMethod(2, "some param", EventArgs.Empty); if (outcome2 != null && outcome2.Result == Outcomes.Success) { Assert.Fail("Failed to verify invalid outcome."); } }
private static void Main(string[] args) { //1. Constructor Injection Client1 client1 = new Client1(new Service()); client1.Start(); //2. Property injection Client2 client2 = new Client2 { Service = new Service() }; client2.Start(); //3. Method injection Client3 client3 = new Client3(); client3.Start(new Service()); Console.ReadLine(); }
internal void AsyncTimeoutResultCallTestException() { ManualResetEvent eventa = new ManualResetEvent(false); AsyncCallResultDelegate delegateInstance = delegate(ISuperPoolClient client, AsyncResultParams parameters) { if (parameters.Exception == null) { // No exception was received, this is not expected. } else { eventa.Set(); } }; Client1.CallAll <ITestInterface>(delegateInstance, 152, TimeSpan.FromSeconds(2)).ExceptionMethod(); if (eventa.WaitOne(20000) == false) { throw new Exception("Test failed due to no exception received."); } }
public static void Main(string[] args) { Client1 client1 = new Client1(); Client2 client2 = new Client2(); Client3 client3 = new Client3(); dhlData DHLData = new dhlData(); fedexData FEDEXData = new fedexData(); CorreosDeMexico CORREOSDEMexico = new CorreosDeMexico(); DHLData.add(client1); DHLData.add(client2); DHLData.add(client3); FEDEXData.add(client1); FEDEXData.add(client2); CORREOSDEMexico.add(client2); DHLData.updatePackageInfo(); FEDEXData.updatePackageInfo(); CORREOSDEMexico.updatePackageInfo(); }
await Send(Client1, gameEndedAction);
public HealthCheckState(Client1 сlient) : base(сlient) { }
public void ShutDownNetworkChannels() { Server.Stop(); Client1.Stop(); Client2.Stop(); }
internal void CallFirst() { Client1.CallFirst <ITestInterface>().AsyncResultMethod(100); }
public static Client1 CreateClient1(int ID, string firstName, string lastName, string gender, global::System.DateTime birthday, global::System.DateTime createdTime, global::System.DateTime updatedTime, string updatedBy, byte[] rowVersion) { Client1 client1 = new Client1(); client1.Id = ID; client1.FirstName = firstName; client1.LastName = lastName; client1.Gender = gender; client1.Birthday = birthday; client1.CreatedTime = createdTime; client1.UpdatedTime = updatedTime; client1.UpdatedBy = updatedBy; client1.RowVersion = rowVersion; return client1; }
public void AddToClients(Client1 client1) { base.AddObject("Clients", client1); }
public InitialState(Client1 сlient) : base(сlient) { }