public void SetUp()
        {
            this.SetupRecognizePackUir();

            this.uri           = new Uri("http://www.rheagroup.com");
            this.assembler     = new Assembler(this.uri);
            this.siteDirectory = new SiteDirectory(Guid.NewGuid(), null, new Uri("http://test.com"));

            this.session = new Mock <ISession>();
            var LazySiteDirectory = new Lazy <Thing>(() => this.siteDirectory);

            this.assembler.Cache.GetOrAdd(new CacheKey(LazySiteDirectory.Value.Iid, null), LazySiteDirectory);

            this.session.Setup(x => x.RetrieveSiteDirectory()).Returns(this.siteDirectory);
            this.session.Setup(x => x.DataSourceUri).Returns("test");
            this.session.Setup(x => x.Assembler).Returns(this.assembler);
            var iterationDictionary = new Dictionary <CDP4Common.EngineeringModelData.Iteration, Tuple <DomainOfExpertise, Participant> >();

            this.session.Setup(x => x.OpenIterations).Returns(iterationDictionary);

            this.appSettingService = new Mock <IAppSettingsService <AddinAppSettings> >();
            this.appSettingService.Setup(x => x.AppSettings).Returns(new AddinAppSettings());

            this.panelNavigationService  = new Mock <IPanelNavigationService>();
            this.dialogNavigationService = new Mock <IDialogNavigationService>();
            this.serviceLocator          = new Mock <IServiceLocator>();

            ServiceLocator.SetLocatorProvider(() => this.serviceLocator.Object);

            var dals          = new List <Lazy <IDal, IDalMetaData> >();
            var availableDals = new AvailableDals(dals);

            this.serviceLocator.Setup(x => x.GetInstance <AvailableDals>()).Returns(availableDals);

            this.assemblyLocationLoader = new Mock <IAssemblyInformationService>();

            var frameworkVersion = new DirectoryInfo(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)).Name;
            var testDirectory    = Path.Combine(Assembly.GetExecutingAssembly().Location, $"..{Path.DirectorySeparatorChar}..{Path.DirectorySeparatorChar}..{Path.DirectorySeparatorChar}..{Path.DirectorySeparatorChar}..{Path.DirectorySeparatorChar}");

#if DEBUG
            this.assemblyLocationLoader.Setup(x => x.GetLocation()).Returns(Path.GetFullPath(Path.Combine(testDirectory, $"CDP4IME{Path.DirectorySeparatorChar}bin{Path.DirectorySeparatorChar}Debug{Path.DirectorySeparatorChar}{frameworkVersion}")));
#else
            this.assemblyLocationLoader.Setup(x => x.GetLocation()).Returns(Path.GetFullPath(Path.Combine(testDirectory, $"CDP4ServicesDal{Path.DirectorySeparatorChar}bin{Path.DirectorySeparatorChar}Release{Path.DirectorySeparatorChar}{frameworkVersion}")));
#endif

            this.serviceLocator.Setup(s => s.GetInstance <IAssemblyInformationService>()).Returns(this.assemblyLocationLoader.Object);

            this.amountOfRibbonControls = 9;
            this.order = 1;

            this.ribbonPart = new AddinRibbonPart(this.order, this.panelNavigationService.Object, null, this.dialogNavigationService.Object, null, this.appSettingService.Object);

            var fluentRibbonManager = new FluentRibbonManager();
            fluentRibbonManager.IsActive = true;
            fluentRibbonManager.RegisterRibbonPart(this.ribbonPart);
        }
示例#2
0
        public void SetUp()
        {
            this.SetupRecognizePackUir();

            this.uri       = new Uri("http://www.rheageoup.com");
            this.assembler = new Assembler(this.uri);

            this.session = new Mock <ISession>();
            var siteDirectory = new Lazy <Thing>(() => new SiteDirectory(Guid.NewGuid(), null, new Uri("http://test.com")));

            this.assembler.Cache.GetOrAdd(new CacheKey(siteDirectory.Value.Iid, null), siteDirectory);
            this.session.Setup(x => x.DataSourceUri).Returns("test");
            this.session.Setup(x => x.Assembler).Returns(this.assembler);

            this.panelNavigationService  = new Mock <IPanelNavigationService>();
            this.dialogNavigationService = new Mock <IDialogNavigationService>();
            this.serviceLocator          = new Mock <IServiceLocator>();

            this.amountOfRibbonControls = 4;
            this.order = 1;

            this.ribbonPart = new AddinRibbonPart(this.order, this.panelNavigationService.Object, null, null, null);

            ServiceLocator.SetLocatorProvider(() => this.serviceLocator.Object);
            this.serviceLocator.Setup(x => x.GetInstance <IDialogNavigationService>())
            .Returns(this.dialogNavigationService.Object);

            var dals          = new List <Lazy <IDal, IDalMetaData> >();
            var availableDals = new AvailableDals(dals);

            this.serviceLocator.Setup(x => x.GetInstance <AvailableDals>()).Returns(availableDals);

            var fluentRibbonManager = new FluentRibbonManager();

            fluentRibbonManager.IsActive = true;
            fluentRibbonManager.RegisterRibbonPart(this.ribbonPart);
        }