static void Main(string[] args) { Server server = null; try { server = new Server() { Services = { WatchService.BindService(new WatchServiceImpl()) }, Ports = { new ServerPort("localhost", Port, ServerCredentials.Insecure) } }; server.Start(); Console.WriteLine("The server is listening on the port : " + Port); Console.ReadKey(); } catch (IOException e) { Console.WriteLine("The server failed to start : " + e.Message); throw; } finally { if (server != null) { server.ShutdownAsync().Wait(); } } }
public WatchController() { db = new KAIROS_SHOPEntities(); watchModelService = new WatchModelService(db); watchService = new WatchService(db); reviewService = new ReviewService(db); }
static void Main(string[] args) { WatchService service = new WatchService(); service.StartListen(); while (true) { Console.ReadLine(); } }
public void TestRepoShouldNotBeCalledIfMachineWatchIsNullOrEmpty() { //Given var mockRepo = new Mock <IWatchRepository>(); var service = new WatchService(mockRepo.Object); //When mockRepo.Setup(mr => mr.SubscribeToMachine(It.IsAny <MachineWatch>())); //Then mockRepo.Verify(mr => mr.SubscribeToMachine(It.IsAny <MachineWatch>()), Times.Never); }
public void TestServiceMethodShouldCallRepoMethodOnce() { //Given var mockRepo = new Mock <IWatchRepository>(); var service = new WatchService(mockRepo.Object); var alarmCode = 1; //When mockRepo.Setup(mr => mr.ReadAllAlarmSubscriptionsByAlarmCode(It.IsAny <int>())).Returns(It.IsAny <List <AlarmWatch> >()); service.GetAlarmSubscriptionsByAlarmCode(alarmCode); //Then mockRepo.Verify(mr => mr.ReadAllAlarmSubscriptionsByAlarmCode(It.IsAny <int>()), Times.Once); }
public void TestRepoShouldNotBeCalledIfWatchIdIsNullOrEmpty(string watchId) { //Given var mockRepo = new Mock <IWatchRepository>(); var service = new WatchService(mockRepo.Object); //When mockRepo.Setup(mr => mr.ReadAllMachineSubscriptionsByWatch(It.IsAny <string>())).Returns(It.IsAny <List <AlarmSystem.Core.Entity.DB.MachineWatch> >()); //Then Assert.Throws <InvalidDataException>(() => service.GetMachineSubscriptionsFromWatch(watchId)); mockRepo.Verify(mr => mr.ReadAllMachineSubscriptionsByWatch(It.IsAny <string>()), Times.Never); }
public AdminController() { db = new KAIROS_SHOPEntities(); watchService = new WatchService(db); modificationService = new ModificationService(db); watchModelService = new WatchModelService(db); movementService = new MovementService(db); accountService = new AccountService(db); roleService = new RoleService(db); orderService = new OrderService(db); orderStatusService = new OrderStatusService(db); orderDetailService = new OrderDetailService(db); }
public void TestRepoShouldNotBeCalledIfAlarmWatchIsNullOrEmpty() { //Given var mockRepo = new Mock <IWatchRepository>(); var service = new WatchService(mockRepo.Object); //When mockRepo.Setup(mr => mr.SubscribeToAlarm(It.IsAny <AlarmWatch>())); //Then //Assert.Throws<InvalidDataException>(() => service.SubscribeToAlarm(aw)); mockRepo.Verify(mr => mr.SubscribeToAlarm(It.IsAny <AlarmWatch>()), Times.Never); }
public void TestServiceShouldCallRepoMethodOnce() { //Given var mockRepo = new Mock<IWatchRepository>(); var service = new WatchService(mockRepo.Object); //When mockRepo.Setup(mr => mr.RemoveAlarmSubscriptionFromWatch(It.IsAny<AlarmWatch>())); service.DeleteAlarmSubscriptionFromWatch(new AlarmWatch()); //Then mockRepo.Verify(mr => mr.RemoveAlarmSubscriptionFromWatch(It.IsAny<AlarmWatch>())); }
public void TestServiceShouldThrowExceptionIfWatchIdIsNullOrEmpty(string watchId) { //Given var mockRepo = new Mock <IWatchRepository>(); var service = new WatchService(mockRepo.Object); int alarmId = 1; //When mockRepo.Setup(mr => mr.ReadSubscriptionOfAlarmFromWatch(It.IsAny <int>(), It.IsAny <string>())).Returns(new AlarmWatch()); //Then Assert.Throws <InvalidDataException>(() => service.GetSubscriptionOfAlarmFromWatch(alarmId, watchId)); mockRepo.Verify(mr => mr.ReadSubscriptionOfAlarmFromWatch(It.IsAny <int>(), It.IsAny <string>()), Times.Never); }
public void TestRepoShouldBeCalledOnceIfMachineIdIsNotEmptyOrNull() { //Given var mockRepo = new Mock <IWatchRepository>(); var service = new WatchService(mockRepo.Object); var machineId = "machine-id-1"; //When mockRepo.Setup(mr => mr.ReadAllMachineSubscriptionsByMachine(It.IsAny <string>())).Returns(It.IsAny <List <MachineWatch> >()); service.GetMachineSubscriptionsByMachine(machineId); //Then mockRepo.Verify(mr => mr.ReadAllMachineSubscriptionsByMachine(It.IsAny <string>()), Times.Once); }
public void TestServiceShouldThrowEntityNotFoundExceptionIfAlarmWatchIsNull() { //Given var mockRepo = new Mock <IWatchRepository>(); var service = new WatchService(mockRepo.Object); int alarmId = 1; string watchId = "watch-id-1"; //When mockRepo.Setup(mr => mr.ReadSubscriptionOfAlarmFromWatch(It.IsAny <int>(), It.IsAny <string>())).Returns(It.IsAny <AlarmWatch>()); //Then Assert.Throws <EntityNotFoundException>(() => service.GetSubscriptionOfAlarmFromWatch(alarmId, watchId)); }
public void TestRepoShouldBeCalledOnceIfWatchIdIsNotEmptyOrNull() { //Given var mockRepo = new Mock <IWatchRepository>(); var service = new WatchService(mockRepo.Object); var watchId = "watch-id-1"; //When mockRepo.Setup(mr => mr.ReadAllMachineSubscriptionsByWatch(It.IsAny <string>())).Returns(It.IsAny <List <AlarmSystem.Core.Entity.DB.MachineWatch> >()); service.GetMachineSubscriptionsFromWatch(watchId); //Then mockRepo.Verify(mr => mr.ReadAllMachineSubscriptionsByWatch(It.IsAny <string>()), Times.Once); }
public void TestServiceShouldCallRepoMethodOnce() { //Given var mockRepo = new Mock <IWatchRepository>(); var service = new WatchService(mockRepo.Object); int alarmId = 1; string watchId = "watch-id-1"; //When mockRepo.Setup(mr => mr.ReadSubscriptionOfAlarmFromWatch(It.IsAny <int>(), It.IsAny <string>())).Returns(new AlarmWatch()); service.GetSubscriptionOfAlarmFromWatch(alarmId, watchId); //Then mockRepo.Verify(mr => mr.ReadSubscriptionOfAlarmFromWatch(It.IsAny <int>(), It.IsAny <string>()), Times.Once); }
public void TestServiceShouldThrowErrorIfParametersAreEmptyOrNull(string machineId, string watchId) { //Given var mockRepo = new Mock <IWatchRepository>(); var service = new WatchService(mockRepo.Object); var mw = new MachineWatch(); //When mockRepo.Setup(mr => mr.ReadMachineSubscriptionOfMachineByWatch(It.IsAny <string>(), It.IsAny <string>())).Returns(mw); //Then Assert.Throws <InvalidDataException>(() => service.GetMachineSubcriptionOfMachineFromWatch(machineId, watchId)); mockRepo.Verify(mr => mr.ReadMachineSubscriptionOfMachineByWatch(It.IsAny <string>(), It.IsAny <string>()), Times.Never); }
public void GetWatchesShouldThrowExceptionForInvalidWatch(int watchtype, int brandname, int straptype, int strapcolor, int segment) { string watchType = "AnalogWatch"; string brandName = "TITAN"; string strapType = "METALIC"; string strapColor = "BLACK"; string Segment = "BASIC"; List <Watch> watches = new List <Watch>(); var mockRepo = new Mock <IWatchRepository>(); mockRepo.Setup(repo => repo.GetWatches(watchType, brandName, strapType, strapColor, Segment)).Returns(watches); WatchService watchService = new WatchService(mockRepo.Object); var actual = Assert.Throws <NoMatchFoundException>(() => watchService.GetWatches(watchtype, brandname, straptype, strapcolor, segment)); Assert.AreEqual("No Match Found, Please Try Another Combination", actual.Message); }
public void TestServiceShouldThrowErrorIfMachineWatchIsNotFound() { //Given var mockRepo = new Mock <IWatchRepository>(); var service = new WatchService(mockRepo.Object); var machineId = "machine-id-1"; var watchId = "watch-id-1"; //When mockRepo.Setup(mr => mr.ReadMachineSubscriptionOfMachineByWatch(It.IsAny <string>(), It.IsAny <string>())).Returns(It.IsAny <MachineWatch>); //Then Assert.Throws <EntityNotFoundException>(() => service.GetMachineSubcriptionOfMachineFromWatch(machineId, watchId)); mockRepo.Verify(mr => mr.ReadMachineSubscriptionOfMachineByWatch(It.IsAny <string>(), It.IsAny <string>()), Times.Once); }
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { #if !USE_PRODUCTION_API System.Net.ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true; #endif #if !DEBUG Firebase.Core.App.Configure(); #endif UNUserNotificationCenter.Current.Delegate = this; UIApplication.SharedApplication.RegisterForRemoteNotifications(); Messaging.SharedInstance.Delegate = this; initializeAnalytics(); Window = new UIWindow(UIScreen.MainScreen.Bounds); Window.MakeKeyAndVisible(); setupNavigationBar(); setupTabBar(); IosDependencyContainer.EnsureInitialized(Window, this); var app = new AppStart(IosDependencyContainer.Instance); app.LoadLocalizationConfiguration(); app.UpdateOnboardingProgress(); app.SetFirstOpened(); app.SetupBackgroundSync(); var accessLevel = app.GetAccessLevel(); loginWithCredentialsIfNecessary(accessLevel); navigateAccordingToAccessLevel(accessLevel, app); var accessibilityEnabled = UIAccessibility.IsVoiceOverRunning; IosDependencyContainer.Instance.AnalyticsService.AccessibilityEnabled.Track(accessibilityEnabled); var watchservice = new WatchService(); watchservice.TryLogWatchConnectivity(); #if ENABLE_TEST_CLOUD Xamarin.Calabash.Start(); #endif return(true); }
public static void GettingWatchList(string userName) { WatchService watchService = new WatchService(); var lstWatches = watchService.GetWatchDetails(userName); if (lstWatches != null && lstWatches.Any()) { Console.WriteLine("*******Your Previous Orders*******"); foreach (var item in lstWatches) { Console.WriteLine($"WatchDetails - {item.WatchDetails} , Order Date - {item.CreatedTime.ToString()}"); } } else { Console.WriteLine("*******You don't have any Previous Orders*******"); } }
public void TestServiceShouldCallRepoOnceIfParametersAreNotEmptyOrNull() { //Given var mockRepo = new Mock <IWatchRepository>(); var service = new WatchService(mockRepo.Object); var machineId = "machine-id-1"; var watchId = "watch-id-1"; var mw = new MachineWatch(); //When mockRepo.Setup(mr => mr.ReadMachineSubscriptionOfMachineByWatch(It.IsAny <string>(), It.IsAny <string>())).Returns(mw); service.GetMachineSubcriptionOfMachineFromWatch(machineId, watchId); //Then mockRepo.Verify(mr => mr.ReadMachineSubscriptionOfMachineByWatch(It.IsAny <string>(), It.IsAny <string>()), Times.Once); }
public void TestRepoShouldBeCalledOnceIfMachineWatchIsNotEmptyOrNull() { //Given var mockRepo = new Mock <IWatchRepository>(); var service = new WatchService(mockRepo.Object); MachineWatch mw = new MachineWatch { Machine = new Core.Entity.DB.Machine { MachineId = "1" }, WatchId = "1" }; //When mockRepo.Setup(mr => mr.SubscribeToMachine(It.IsAny <MachineWatch>())); service.SubscribeToMachine(mw); //Then mockRepo.Verify(mr => mr.SubscribeToMachine(It.IsAny <MachineWatch>()), Times.Once); }
public void GetWatchesShouldReturnDigitalWatch() { string watchType = "DigitalWatch"; string brandName = "TITAN"; string strapType = "METALIC"; string strapColor = "BLACK"; string Segment = "BASIC"; List <Watch> watches = new List <Watch> { new DigitalWatch { WatchId = 2111, BrandName = "TITAN", StrapType = "METALIC", StrapColor = "BLACK", Segment = "BASIC", Price = 8000, DisplayMode = "24Hour", HasBackLight = true } }; var mockRepo = new Mock <IWatchRepository>(); mockRepo.Setup(repo => repo.GetWatches(watchType, brandName, strapType, strapColor, Segment)).Returns(watches); WatchService watchService = new WatchService(mockRepo.Object); var actual = watchService.GetWatches(2, 2, 1, 1, 1); Assert.IsAssignableFrom <DigitalWatch>(actual); Assert.AreEqual("DigitalWatch", actual.GetType().Name); }
public void GetWatchesShouldReturnAnalogWatch() { string watchType = "AnalogWatch"; string brandName = "FASTTRACK"; string strapType = "METALIC"; string strapColor = "BLACK"; string Segment = "BASIC"; List <Watch> watches = new List <Watch> { new AnalogWatch() { WatchId = 1101, BrandName = "FASTTRACK", StrapType = "METALIC", StrapColor = "BLACK", Segment = "BASIC", Price = 4000, NumberOfHands = 2, HasCalender = false } }; var mockRepo = new Mock <IWatchRepository>(); mockRepo.Setup(repo => repo.GetWatches(watchType, brandName, strapType, strapColor, Segment)).Returns(watches); WatchService watchService = new WatchService(mockRepo.Object); var actual = watchService.GetWatches(1, 1, 1, 1, 1); Assert.IsAssignableFrom <AnalogWatch>(actual); Assert.AreEqual("AnalogWatch", actual.GetType().Name); }
public void TestRepoShouldBeCalledOnceIfAlarmWatchIsNotEmptyOrNull() { //Given var mockRepo = new Mock <IWatchRepository>(); var service = new WatchService(mockRepo.Object); AlarmWatch aw = new AlarmWatch { Alarm = new Core.Entity.DB.Alarm { AlarmId = 1, Code = 205, Description = "TestDescription" }, WatchId = "1" }; //When mockRepo.Setup(mr => mr.SubscribeToAlarm(It.IsAny <AlarmWatch>())); service.SubscribeToAlarm(aw); //Then mockRepo.Verify(mr => mr.SubscribeToAlarm(It.IsAny <AlarmWatch>()), Times.Once); }
internal TestFileSystemWatcher(WatchService watchService) : base(watchService) { }
public void Parse_No_Services() { var sourceService = new Mock <ISourceService>(); var input = "hot fuzz"; sourceService.Setup(x => x.Query(input)).Returns(new SourceResponse { Items = new List <WatchItem> { new WatchItem { Title = "Hot Fuzz", Offers = new List <Offer> { new Offer { MonetizationType = MonetizationType.FlatRate, Urls = new SourceUrls { StandardWeb = "netflix" } }, new Offer { MonetizationType = MonetizationType.FlatRate, Urls = new SourceUrls { StandardWeb = "amazon" } }, }, } } }); var userService = new Mock <IUserService>(); userService.Setup(x => x.GetUserServicePreferences(It.IsAny <long>())) .Returns(new[] { new UserServicePreference { Preference = -1, MonetizationType = new MonetizationType { TypeName = MonetizationType.FlatRate }, Service = new Service { Name = "amazon", Urls = { new ServiceUrl { Url = "amazon" //todo: fix so .com works } } }, }, new UserServicePreference { Preference = -1, MonetizationType = new MonetizationType { TypeName = MonetizationType.FlatRate }, Service = new Service { Name = "netflix", Urls = { new ServiceUrl { Url = "netflix" //todo: fix so .com works } } }, }, }); var service = new WatchService(sourceService.Object, userService.Object, GetStreamingServiceService()); var result = service.GetHowToWatch(input, 1); //order of result is changed based on the provided user preference result.Should().Be("Hot Fuzz is not available on any of your flat rate streaming services"); }
public void Parse_AvoidService() { var sourceService = new Mock <ISourceService>(); var input = "hot fuzz"; sourceService.Setup(x => x.Query(input)).Returns(new SourceResponse { Items = new List <WatchItem> { new WatchItem { Title = "Hot Fuzz", Offers = new List <Offer> { new Offer { MonetizationType = MonetizationType.FlatRate, Urls = new SourceUrls { StandardWeb = "netflix" } }, new Offer { MonetizationType = MonetizationType.FlatRate, Urls = new SourceUrls { StandardWeb = "amazon" } }, }, } } }); var userService = new Mock <IUserService>(); userService.Setup(x => x.GetUserServicePreferences(It.IsAny <long>())) .Returns(new[] { new UserServicePreference { MonetizationType = new MonetizationType { TypeName = MonetizationType.FlatRate }, Service = new Service { Name = "amazon", Urls = { new ServiceUrl { Url = "amazon" //todo: fix so .com works } } }, Preference = -1, } }); var service = new WatchService(sourceService.Object, userService.Object, GetStreamingServiceService()); var result = service.GetHowToWatch(input, 1); result.Should().Be("Hot Fuzz can be watched for free on Netflix"); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public org.neo4j.io.fs.watcher.FileWatcher fileWatcher() throws java.io.IOException public override FileWatcher FileWatcher() { WatchService watchService = FileSystems.Default.newWatchService(); return(new DefaultFileSystemWatcher(watchService)); }
public HomeController() { db = new KAIROS_SHOPEntities(); watchService = new WatchService(db); shoppingService = new ShoppingCartService(db); }
public DefaultFileSystemWatcher(WatchService watchService) { this._watchService = watchService; }