Esempio n. 1
0
        public static void RegisterComponents()
        {
            var container = new UnityContainer();

            var configurationProvider = new ConfigurationProvider();

            container.RegisterFactory <IWebApiExceptionLogger>(f =>
                                                               GoogleWebApiExceptionLogger.Create(
                                                                   configurationProvider.ProjectId,
                                                                   configurationProvider.ServiceName,
                                                                   configurationProvider.ServiceVersion));

            container.RegisterType <IFluentBlaiseApi, FluentBlaiseApi>();
            container.RegisterType <IConfigurationProvider, ConfigurationProvider>();
            container.RegisterType <IParkService, ParkService>();
            container.RegisterType <ISurveyService, SurveyService>();

#if DEBUG
            var credentialKey = ConfigurationManager.AppSettings["GOOGLE_APPLICATION_CREDENTIALS"];

            Environment.SetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS", credentialKey);
#endif

            GlobalConfiguration.Configuration.DependencyResolver = new UnityDependencyResolver(container);
        }
Esempio n. 2
0
        public string ThrowCatchWithGoogleWebApiLogger(string id)
        {
            var exceptionLogger = GoogleWebApiExceptionLogger.Create(TestEnvironment.GetTestProjectId(), EntryData.Service, EntryData.Version);
            var message         = EntryData.GetMessage(nameof(ThrowCatchWithGoogleWebApiLogger), id);

            try
            {
                throw new Exception(message);
            }
            catch (Exception e)
            {
                exceptionLogger.Log(e, ActionContext);
            }
            return(message);
        }
        public string ThrowCatchWithGoogleWebApiLogger(string id)
        {
            var exceptionLogger = GoogleWebApiExceptionLogger.Create(ProjectId, Service, Version);
            var message         = GetMessage(nameof(ThrowCatchWithGoogleWebApiLogger), id);

            try
            {
                throw new Exception(message);
            }
            catch (Exception e)
            {
                exceptionLogger.Log(e, ActionContext);
            }
            return(message);
        }