Beispiel #1
0
        public void FixtureSetUp()
        {
            WibuInit.InitDependencies();

            DashboardDummy dashboard = new DashboardDummy {
                Name = "Dashboard 1"
            };

            mockGuiToolkit = new Mock <IGUIToolkit> ();
            mockDialogs    = new Mock <IDialogs> ();
            mockProvider   = new Mock <ICategoriesTemplatesProvider> ();

            mockGuiToolkit.SetupGet(x => x.DeviceScaleFactor).Returns(1.0f);
            mockGuiToolkit.Setup(x => x.CreateNewTemplate <Dashboard> (It.IsAny <IList <Dashboard> > (),
                                                                       It.IsAny <string> (),
                                                                       It.IsAny <string> (),
                                                                       It.IsAny <string> (),
                                                                       It.IsAny <CreateEvent <Dashboard> > ()
                                                                       )).ReturnsAsync(true);
            mockDialogs.Setup(x => x.OpenFile(It.IsAny <string> (), It.IsAny <string> (), It.IsAny <string> (),
                                              It.IsAny <string> (), It.IsAny <string []> ())).Returns("Dashboard.lct");
            mockDialogs.Setup(x => x.QuestionMessage(It.IsAny <string> (), It.IsAny <string> (), It.IsAny <object> ()))
            .ReturnsAsync(true);
            mockDialogs.Setup(m => m.QueryMessage(It.IsAny <string> (), null, It.IsAny <string> (),
                                                  It.IsAny <object> ())).Returns(AsyncHelpers.Return("dashboard_copy"));
            mockProvider.Setup(x => x.LoadFile(It.IsAny <string> ())).Returns(dashboard);
            mockProvider.Setup(x => x.Templates).Returns(new List <Dashboard> {
                dashboard
            });

            mockLimitationService = new Mock <ILicenseLimitationsService> ();
            countLimitationVM     = new CountLimitationVM()
            {
                Model = new CountLicenseLimitation {
                    RegisterName = LongoMatchCountLimitedObjects.Team.ToString(),
                    Enabled      = true,
                    Maximum      = 2
                }
            };
            mockLimitationService.Setup(x => x.Get <CountLimitationVM> (It.IsAny <string> ())).Returns(countLimitationVM);
            App.Current.LicenseLimitationsService = mockLimitationService.Object;

            App.Current.GUIToolkit = mockGuiToolkit.Object;
            App.Current.Dialogs    = mockDialogs.Object;
            App.Current.CategoriesTemplatesProvider = mockProvider.Object;

            controller = new DashboardsController();
        }
        public void FixtureSetUp()
        {
            WibuInit.InitDependencies();

            DummyTeam team = new DummyTeam {
                Name = "Team 1"
            };

            mockGuiToolkit = new Mock <IGUIToolkit> ();
            mockDialogs    = new Mock <IDialogs> ();
            mockProvider   = new Mock <ITeamTemplatesProvider> ();

            mockGuiToolkit.Setup(x => x.CreateNewTemplate <Team> (It.IsAny <IList <Team> > (),
                                                                  It.IsAny <string> (),
                                                                  It.IsAny <string> (),
                                                                  It.IsAny <string> (),
                                                                  It.IsAny <CreateEvent <Team> > ()
                                                                  )).ReturnsAsync(true);
            mockDialogs.Setup(x => x.OpenFile(It.IsAny <string> (), It.IsAny <string> (), It.IsAny <string> (),
                                              It.IsAny <string> (), It.IsAny <string []> ())).Returns("Team.ltt");
            mockDialogs.Setup(m => m.QueryMessage(It.IsAny <string> (), null, It.IsAny <string> (),
                                                  It.IsAny <object> ())).Returns(AsyncHelpers.Return("team_copy"));
            mockDialogs.Setup(x => x.QuestionMessage(It.IsAny <string> (), It.IsAny <string> (), It.IsAny <object> ()))
            .ReturnsAsync(true);
            mockProvider.Setup(x => x.LoadFile(It.IsAny <string> ())).Returns(team);
            mockProvider.Setup(x => x.Templates).Returns(new List <Team> ());

            App.Current.GUIToolkit            = mockGuiToolkit.Object;
            App.Current.Dialogs               = mockDialogs.Object;
            App.Current.TeamTemplatesProvider = mockProvider.Object;

            mockLimitationService = new Mock <ILicenseLimitationsService> ();
            countLimitationVM     = new CountLimitationVM()
            {
                Model = new CountLicenseLimitation {
                    RegisterName = LongoMatchCountLimitedObjects.Team.ToString(),
                    Enabled      = true,
                    Maximum      = 2
                }
            };
            mockLimitationService.Setup(x => x.Get <CountLimitationVM> (It.IsAny <string> ())).Returns(countLimitationVM);
            App.Current.LicenseLimitationsService = mockLimitationService.Object;

            controller = new TeamsController();
        }
 public void TestFixtureSetUp()
 {
     WibuInit.InitDependencies();
     currentLicenseManager = App.Current.LicenseManager;
 }