예제 #1
0
        public static void Main(string[] args)
        {
            /* For testing. Setting last processed date */
            var settings = new SettingsRepository();

            settings.AddOrUpdateSetting(Globals.LastProcessedKey, "20160218");
            settings.Save();

            /********************** Web ServiceFacade ************************/
            HostFactory.Run(x =>
            {
                x.UseLog4Net();
                x.Service <Program>(s =>
                {
                    s.ConstructUsing(() => new Program());
                    s.BeforeStartingService(b => { BeforeStarting(); });
                    s.WhenStarted((service, host) => true);
                    s.WhenFileSystemCreated(config =>
                                            config.AddDirectory(dir =>
                    {
                        dir.Path          = Dir;
                        dir.FileFilter    = "*.txt";
                        dir.CreateDir     = false;
                        dir.NotifyFilters = NotifyFilters.FileName;
                    }), FileArrived);
                    s.WhenStopped((service, host) => true);
                });
                x.RunAsLocalSystem();

                x.SetDescription("ImportService missing data to Apisci");
                x.SetDisplayName("Apisci ImportService Module");
                x.SetServiceName("ApisciImportModule");
            });
        }
예제 #2
0
        public void AddOrUpdate_Settings_Adding_SettingsObject()
        {
            var mockSet = new Mock <DbSet <Settings> >();

            var mockContext = new Mock <ImportContext>();

            mockContext.Setup(m => m.Settings).Returns(mockSet.Object);

            var settings = new SettingsRepository(mockContext.Object);

            settings.AddOrUpdateSetting(new Settings {
                Key = "TestKEY", Value = "TestValue"
            });

            mockSet.Verify(m => m.Add(It.IsAny <Settings>()), Times.Once);
        }
예제 #3
0
        public void AddOrUpdate_Settings_Adding_key_Value()
        {
            var mockSet = new Mock <DbSet <Settings> >();

            var mockContext = new Mock <ImportContext>();

            mockContext.Setup(m => m.Settings).Returns(mockSet.Object);

            var settings = new SettingsRepository(mockContext.Object);

            settings.AddOrUpdateSetting("testKey", "testValue");
            settings.Save();

            mockSet.Verify(m => m.Add(It.IsAny <Settings>()), Times.Once);
            mockContext.Verify(m => m.SaveChanges(), Times.Once);
        }
예제 #4
0
        public void Save_Settings()
        {
            var mockSet = new Mock <DbSet <Settings> >();

            var mockContext = new Mock <ImportContext>();

            mockContext.Setup(m => m.Settings).Returns(mockSet.Object);

            var settings = new SettingsRepository(mockContext.Object);

            settings.AddOrUpdateSetting(new Settings {
                Key = "TestKEY", Value = "TestValue"
            });
            settings.Save();

            mockContext.Verify(m => m.SaveChanges(), Times.Once);
        }