static void Main(string[] args) { bool createdNew = true; using (Mutex mutex = new Mutex(true, "ZooService", out createdNew)) { if (createdNew) { const int port = 2560; Console.WriteLine($"Starting Zoo Service on port {port}, please wait..."); ZooService service = new ZooService(port); service.Start(); Console.WriteLine("Zoo Service is ON. Press [E] to stop."); while (Console.ReadKey().Key == ConsoleKey.E) { ; } } else { Process current = Process.GetCurrentProcess(); foreach (Process process in Process.GetProcessesByName(current.ProcessName)) { if (process.Id != current.Id) { SetForegroundWindow(process.MainWindowHandle); break; } } } } }
public void SetUp() { ctxSeq = new MockSequence(); ctx = new Mock <ZooContext>(); ctx.Setup(x => x.DeleteWorker(2)).Returns(new System.Tuple <bool, byte>(false, (byte)ModelType.Attraction)); ctx.InSequence(ctxSeq).Setup(x => x.DeleteAttraction(1)).Returns(new System.Tuple <bool, byte>(true, 0)); ctx.InSequence(ctxSeq).Setup(x => x.DeleteWorker(2)).Returns(new System.Tuple <bool, byte>(true, 0)); service = new ZooService.ZooService(1111); }
public void SetUp() { IZooContext = new Mock <ZooContext>(); service = new ZooService.ZooService(1111); animals = new List <Animal>(); var animal = new Animal(); animals.Add(animal); }
public void SetUp() { service = new ZooService.ZooService(1111); comModel = new ZooCom.Model.Animal { ID = ID, MaintenanceCost = decimalTest, Name = stringTest, PlaceID = ID, FoodID = ID, Count = intTest }; animalUnit = new Animal { ID = ID, MaintenanceCost = decimalTest, Name = stringTest, PlaceID = ID, FoodID = ID, Count = intTest }; }
public void Setup() { IZooContext = new Mock <ZooContext>(); service = new ZooService.ZooService(1111); }