Ejemplo n.º 1
0
        public void Setup()
        {
            this.innovatorUser     = new InnovatorUser();
            this.serverConnection  = Substitute.For <IServerConnection>();
            this.innovatorInstance = new Innovator(this.serverConnection);
            this.iOMWrapper        = Substitute.For <IIOMWrapper>();

            this.authManager   = new AuthenticationManagerProxy(serverConnection, innovatorInstance, innovatorUser, iOMWrapper);
            this.dialogFactory = Substitute.For <IDialogFactory>();
            this.projectConfigurationManager = Substitute.For <IProjectConfigurationManager>();
            this.projectConfiguration        = Substitute.For <IProjectConfiguraiton>();
            this.templateLoader = new TemplateLoader(dialogFactory);
            this.packageManager = new PackageManager(authManager);

            ConnectionInfo testConnectionInfo = new ConnectionInfo()
            {
                LastConnection = true
            };

            this.projectConfiguration.Connections.Returns(new List <ConnectionInfo>()
            {
                testConnectionInfo
            });

            this.openFromArasViewModel = new OpenFromArasViewModel(authManager,
                                                                   dialogFactory,
                                                                   projectConfigurationManager,
                                                                   projectConfiguration,
                                                                   templateLoader,
                                                                   packageManager,
                                                                   "tesPathToProjectConfigFile",
                                                                   "testProjectName",
                                                                   "testProjectFullName",
                                                                   "testProjectLanguage");
        }
Ejemplo n.º 2
0
        public void Setup()
        {
            this.innovatorUser     = new InnovatorUser();
            this.serverConnection  = Substitute.For <IServerConnection>();
            this.innovatorInstance = new Innovator(this.serverConnection);
            this.iOMWrapper        = Substitute.For <IIOMWrapper>();

            this.authManager   = new AuthenticationManagerProxy(serverConnection, innovatorInstance, innovatorUser, iOMWrapper);
            this.dialogFactory = Substitute.For <IDialogFactory>();
            this.projectConfigurationManager = Substitute.For <IProjectConfigurationManager>();
            this.projectConfiguration        = Substitute.For <IProjectConfiguraiton>();
            this.messageManager      = Substitute.For <MessageManager>();
            this.packageManager      = new PackageManager(authManager, messageManager);
            this.arasDataProvider    = Substitute.For <IArasDataProvider>();
            this.methodInformation   = new MethodInfo();
            this.templateLoader      = new TemplateLoader();
            this.projectManager      = Substitute.For <IProjectManager>();
            this.codeProvider        = Substitute.For <ICodeProvider>();
            this.globalConfiguration = Substitute.For <IGlobalConfiguration>();

            this.globalConfiguration.GetUserCodeTemplatesPaths().Returns(new List <string>());

            this.serverConnection.When(x => x.CallAction("ApplyItem", Arg.Is <XmlDocument>(doc => doc.DocumentElement.Attributes["type"].Value == "Value"), Arg.Any <XmlDocument>()))
            .Do(x =>
            {
                (x[2] as XmlDocument).Load(Path.Combine(currentPath, @"Dialogs\ViewModels\TestData\ActionLocationsListValue.xml"));
            });

            this.serverConnection.When(x => x.CallAction("ApplyItem", Arg.Is <XmlDocument>(doc => doc.DocumentElement.Attributes["type"].Value == "Filter Value"), Arg.Any <XmlDocument>()))
            .Do(x =>
            {
                (x[2] as XmlDocument).Load(Path.Combine(currentPath, @"Dialogs\ViewModels\TestData\MethodTypesListFilterValue.xml"));
            });

            this.projectConfiguration.LastSavedSearch.Returns(new Dictionary <string, List <PropertyInfo> >());

            XmlDocument methodItemTypeAML = new XmlDocument();

            methodItemTypeAML.Load(Path.Combine(currentPath, @"Dialogs\ViewModels\TestData\MethodItemType.xml"));

            Item methodItemType = this.innovatorInstance.newItem();

            methodItemType.loadAML(methodItemTypeAML.OuterXml);

            this.arasDataProvider.GetMethodItemTypeInfo().Returns(new MethodItemTypeInfo(methodItemType, messageManager));

            this.createMethodViewModel = new CreateMethodViewModel(authManager,
                                                                   dialogFactory,
                                                                   projectConfiguration,
                                                                   templateLoader,
                                                                   packageManager,
                                                                   projectManager,
                                                                   arasDataProvider,
                                                                   codeProvider,
                                                                   globalConfiguration,
                                                                   messageManager);
        }
        public void Setup()
        {
            this.innovatorUser         = new InnovatorUser();
            this.serverConnection      = Substitute.For <IServerConnection>();
            this.innovator             = new Innovator(this.serverConnection);
            this.authenticationManager = new AuthenticationManagerProxy(this.serverConnection,
                                                                        this.innovator,
                                                                        this.innovatorUser,
                                                                        Substitute.For <IIOMWrapper>());

            List <ConnectionInfo> connectionInfo = new List <ConnectionInfo>();

            this.projectConfiguraiton = Substitute.For <IProjectConfiguraiton>();
            this.projectConfiguraiton.Connections.Returns(connectionInfo);

            this.loginViewModel = new LoginViewModel(this.authenticationManager,
                                                     this.projectConfiguraiton,
                                                     "testProjectName",
                                                     "testProjectFullName");
        }
 public AuthenticationManagerProxy(IServerConnection serverConnection, Innovator innovator, InnovatorUser innovatorUser, IIOMWrapper iOMWrapperInstance)
 {
     this.ServerConnection   = serverConnection;
     this.InnovatorInstance  = innovator;
     this.InnovatorUser      = innovatorUser;
     this.IOMWrapperInstance = iOMWrapperInstance;
 }