public App() { InitializeComponent(); IoCContainer.Configure(); MainPage = new NavigationPage(new ListViewEjemploView()); }
public void Form_Integration_Services_Get_Dictionary_Empty() { IoCContainer.Configure(x => x.For <IUmbracoService>().Use(new Mock <IUmbracoService>().Object)); var service = IoCContainer.GetInstance <IIntegrationService>(); Message message = new Message(); var result = service.GetKeyFromDictionary(message); Assert.IsTrue(string.IsNullOrEmpty(result.Description)); }
public void Form_Integration_Services_Get_Dictionary_Null() { IoCContainer.Configure(x => x.For <IUmbracoService>().Use(new Mock <IUmbracoService>().Object)); var service = IoCContainer.GetInstance <IIntegrationService>(); Message message = null; var result = service.GetKeyFromDictionary(message); Assert.IsNull(result); }
public override void Initialize() { base.Initialize(); IoCContainer.Configure(x => x.For <Umbraco.Core.Services.IContentService>().Use(new Mock <IContentService>().Object)); var media = new Mock <IMedia>(); mediaService = new Mock <IMediaService>(); mediaService.Setup(x => x.CreateMedia(It.IsAny <string>(), It.IsAny <int>(), It.IsAny <string>(), 0)).Returns(media.Object); IoCContainer.Configure(x => x.For <Umbraco.Core.Services.IMediaService>().Use(mediaService.Object)); IoCContainer.Configure(x => x.For <UmbracoHelper>().Use(umbracoHelper)); }
public MainWindow() { IoCContainer.Configure(); Scope = IoCContainer.Container.BeginLifetimeScope(); SelectedItem = Scope.Resolve <ISelectedItem>(); DataContext = Scope.Resolve <IPlayerViewModel>(); InitializeComponent(); LabelDescription.DataContext = SelectedItem.SelectedDescription; MouseLeftButtonDown += (x, y) => Keyboard.ClearFocus(); }
public override void Initialize() { base.Initialize(); IoCContainer = StructureMapContainerInit.InitilizeTestContainer(); //FakeUmbracoContext(); var appCtx = CreateApplicationContext(); FakeUmbracoContext(appCtx); IoCContainer.Configure(x => x.For <UmbracoHelper>().Use(new UmbracoHelper(UmbracoContext.Current))); IoCContainer.Configure(x => x.For <Examine.ExamineManager>().Use(Examine.ExamineManager.Instance)); AutoMapperConfiguration.Configure(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDbContext <ApplicationDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("Identity"))); services.AddIdentity <ApplicationUser, IdentityRole <long> >() .AddEntityFrameworkStores <ApplicationDbContext>() .AddDefaultTokenProviders(); services.Configure <IdentityOptions>(options => { // Password settings options.Password.RequireDigit = true; options.Password.RequiredLength = 6; options.Password.RequireLowercase = false; options.Password.RequireNonAlphanumeric = false; options.Password.RequireUppercase = false; // User settings options.SignIn.RequireConfirmedEmail = true; }); IoCContainer.Configure(services); services.AddSingleton <Serilog.ILogger> (x => new LoggerConfiguration() .MinimumLevel.Information() .WriteTo.File(".\\Logs\\Prometheus.txt", rollingInterval: RollingInterval.Month) .CreateLogger()); services.AddScoped <IUserClaimsPrincipalFactory <ApplicationUser>, AppClaimsPrincipalFactory>(); services.AddTransient <IEmailSender, EmailSender>(); services.AddScoped <IUserHandler, UserHandler>(); //Hangfire services.AddHangfire(config => config.UseSqlServerStorage(Configuration.GetConnectionString("Hangfire"))); services.AddAutoMapper(x => x.AddProfile(new MappingEntity())); services.AddMvc(); services.AddOptions(); services.Configure <AdapterSeed>(Configuration.GetSection("AdapterSeed")); services.Configure <RSSUrlSeed>(Configuration.GetSection("RSSUrlSeed")); services.AddSignalR(); }
public void Form_Integration_Services_Get_Dictionary_Corret() { Message message = new Message(); message.Description = "Description"; message.Key = "Key"; var umbService = new Mock <IUmbracoService>(); umbService.Setup(x => x.GetDictionaryItem(message.Key, message.Description)).Returns(message.Description); IoCContainer.Configure(x => x.For <IUmbracoService>().Use(umbService.Object)); var service = IoCContainer.GetInstance <IIntegrationService>(); var result = service.GetKeyFromDictionary(message); Assert.IsTrue(result.Description.Equals(message.Description)); }