/// <summary> /// Initializes a new instance of the <see cref="AssetEditor" /> class. /// </summary> /// <param name="assetManagerFactory">The asset manager factory.</param> /// <param name="viewFactory">The view factory.</param> /// <param name="drawerFactory">The drawer factory.</param> /// <param name="paletFactory">The palet factory.</param> /// <param name="previewBarFactory">The preview bar factory.</param> /// <param name="fileLocationProvider">The file location provider.</param> public AssetEditor( AssetManagerFactory assetManagerFactory, ViewFactory viewFactory, DrawerFactory drawerFactory, PaletFactory paletFactory, PreviewBarFactory previewBarFactory, FileLocationProvider fileLocationProvider) { this.InitializeComponent(); this.viewFactory = viewFactory; this.drawerFactory = drawerFactory; this.paletFactory = paletFactory; this.previewBarFactory = previewBarFactory; this.fileLocationProvider = fileLocationProvider; this.assetManager = assetManagerFactory.Get(this.fileLocationProvider.AssetFile, false); this.palet = this.paletFactory.Get(this.PaletPanel); this.drawer = this.drawerFactory.Get(this.DrawerPanel); this.previewBar = this.previewBarFactory.Get(this.PreviewBar); this.ButtonSize.Value = Settings.Default.ZoomLevel; // Event handler setup must precede loading assets but happen after the asset manager is created this.SetupEventHandlers(); // Load assets and trigger events. this.assetManager.LoadAssets(); if (this.assetManager.CurrentAsset != null) { this.previewBar.Draw(this.assetManager.CurrentAsset.Shapes); } }
/// <summary> /// Registers application dependencies to the container builder. /// </summary> internal static void RegisterApplicationDependencies(ContainerBuilder containerBuilder, IConfigurationSection appsettings) { string classRepositoryPath = appsettings["ClassRepository"]; string testRepositoryPath = appsettings["TestRepository"]; string spreadsheetDirectoryPath = appsettings["SpreadsheetDirectory"]; string magisterDirectoryPath = appsettings["ClassesDirectory"]; containerBuilder.RegisterType <Application>(); containerBuilder.RegisterType <ClassService>().As <IClassService>(); containerBuilder.RegisterType <TestService>().As <ITestService>(); containerBuilder.RegisterType <Validator <CreateClassRequest> >().As <IValidator <CreateClassRequest> >(); containerBuilder.RegisterType <Validator <CreateMagisterClassRequest> >().As <IValidator <CreateMagisterClassRequest> >(); containerBuilder.RegisterType <Validator <AddStudentRequest> >().As <IValidator <AddStudentRequest> >(); containerBuilder.RegisterType <Validator <CreateTestRequest> >().As <IValidator <CreateTestRequest> >(); containerBuilder.RegisterType <Validator <AddAssignmentRequest> >().As <IValidator <AddAssignmentRequest> >(); containerBuilder.RegisterType <NumberOfQuestionsMustBeValid>().As <IValidationRule <AddAssignmentRequest> >(); containerBuilder.RegisterType <Cifra.Application.Validation.StudentModelValidationRules.FirstNameMustBeFilled>().As <IValidationRule <AddStudentRequest> >(); containerBuilder.RegisterType <Cifra.Application.Validation.StudentModelValidationRules.LastNameMustBeFilled>().As <IValidationRule <AddStudentRequest> >(); containerBuilder.RegisterType <Cifra.Application.Validation.TestModelValidationRules.NameMustBeFilled>().As <IValidationRule <CreateTestRequest> >(); containerBuilder.RegisterType <Cifra.Application.Validation.TestModelValidationRules.NumberOfVersionsMustBeValid>().As <IValidationRule <CreateTestRequest> >(); containerBuilder.RegisterType <Cifra.Application.Validation.ClassModelValidationRules.NameMustBeFilled>().As <IValidationRule <CreateClassRequest> >(); containerBuilder.RegisterType <Cifra.Application.Validation.MagisterClassModelValidationRules.FileLocationMustBeFilled>().As <IValidationRule <CreateMagisterClassRequest> >(); var fileLocationProvider = new FileLocationProvider( Path.CreateFromString(classRepositoryPath), Path.CreateFromString(testRepositoryPath), Path.CreateFromString(spreadsheetDirectoryPath), Path.CreateFromString(magisterDirectoryPath) ); containerBuilder.RegisterInstance(fileLocationProvider).AsImplementedInterfaces(); containerBuilder.RegisterModule <AreaModule>(); containerBuilder.RegisterModule <FileSystemModule>(); }
public void GetClassesDirectoryPath_PreviousSetPath_ReturnsPath() { // Arrange Path expectedPath = _fixture.Create <Path>(); var sut = new FileLocationProvider(null, null, null, expectedPath); // Act Path result = sut.GetClassesDirectoryPath(); // Assert result.Should().NotBeNull(); result.Should().Be(expectedPath); }