private void Login(object sender, EventArgs e) { if (ValidateFields()) { User user = new User(); user.UserName = txtLogin.Text; user.Password = txtPassword.Text; if (controller.ExistUser(user)) { WelcomeController w = new WelcomeController(); this.NavigationController.PushViewController(w, true); } else { //No existe el usario con dicha contraseƱa en la db UIAlertView alert = new UIAlertView() { Title = "Error", Message = "Error en el usuario o la clave" }; alert.AddButton("OK"); alert.Show(); } } else { //No ha ingresado todos los campos UIAlertView alert = new UIAlertView() { Title = "Error", Message = "Por favor ingrese sus datos" }; alert.AddButton("OK"); alert.Show(); } }
private void Login(object sender, EventArgs e) { if (ValidateFields ()) { User user = new User (); user.UserName = txtLogin.Text; user.Password = txtPassword.Text; if (controller.ExistUser (user)) { WelcomeController w = new WelcomeController (); this.NavigationController.PushViewController (w, true); } else { //No existe el usario con dicha contraseƱa en la db UIAlertView alert = new UIAlertView () { Title = "Error", Message = "Error en el usuario o la clave" }; alert.AddButton ("OK"); alert.Show (); } } else { //No ha ingresado todos los campos UIAlertView alert = new UIAlertView () { Title = "Error", Message = "Por favor ingrese sus datos" }; alert.AddButton ("OK"); alert.Show (); } }
public void LoginUser() { WelcomeController controller = CreateController <WelcomeController>(); var view = (ViewResult)controller.LoginUser(); Assert.IsNull(view.Model, "No model for default login view"); }
public void WelcomeController_Index_ReturnDefaultView() { WelcomeController wc = new WelcomeController(); ViewResult vr = (ViewResult)wc.Index(); Assert.AreEqual(string.Empty, vr.ViewName); }
public void NewUser() { WelcomeController controller = CreateController <WelcomeController>(); var view = (ViewResult)controller.NewUser(); Assert.AreEqual("NewUser", view.ViewName); }
public virtual void SetUp() { _regionManagerStub = new RegionManagerStub(); _modalRegion = _regionManagerStub.CreateAndAddMock(RegionNames.WindowRegion); _welcomeSettingsRegion = _regionManagerStub.CreateAndAddMock(ShellRegionNames.WelcomeSettingsRegion); _welcomeViewMock = new Mock <IWelcomeView>(); var vm = new WelcomeViewModel(); _welcomeViewMock.SetupGet(v => v.ViewModel).Returns(vm); _connectivitySettingsVMMock = new Mock <IConnectivitySettingsViewModel>(); _connectivitySettingsViewMock = new Mock <IConnectivitySettingsView>(); _connectivitySettingsViewMock.Setup(v => v.ViewModel).Returns(_connectivitySettingsVMMock.Object); _accountSettingsVMMock = new Mock <IAccountSettingsViewModel>(); _accountSettingsViewMock = new Mock <IAccountSettingsView>(); _accountSettingsViewMock.Setup(v => v.ViewModel).Returns(_accountSettingsVMMock.Object); _welcomeStep1ViewMock = new Mock <IWelcomeStep1View>(); _demoViewMock = new Mock <IDemoView>(); _welcomeController = new WelcomeController(_regionManagerStub, _welcomeViewMock.Object, _welcomeStep1ViewMock.Object, _connectivitySettingsViewMock.Object, _accountSettingsViewMock.Object, _demoViewMock.Object); }
public void Get() { var message = new WelcomeMessage("hello from test"); var controller = new WelcomeController(message); Assert.Equal("hello from test", controller.SayHello()); }
public void Setup() { _gameCache = new MemoryCache(mco); _welcomeSontroller = new WelcomeController(new AdventureServer.Services.AppVersionService()); _adventureFramework = new AdventureFrameworkService(_gameCache); _adventureController = new AdventureController(_adventureFramework); // _playAdventureController = new PlayAdventureController(_adventureController); }
public void TestAPIGetWelcomeMessage() { var controller = new WelcomeController(); var response = controller.GetWelcomeMessage(); Assert.IsNotNull(response); Assert.IsInstanceOfType(response, typeof(string)); Assert.AreEqual("Hello World!", response); }
public void Get() { var message = new WelcomeMessage("hello from test"); IConfiguration config = new Mock <IConfiguration>().Object; var controller = new WelcomeController(message, config); Assert.Equal("hello from test", controller.SayHello()); }
public void Get() { // Arrange var message = new WelcomeMessage("hello from test"); // Act var controller = new WelcomeController(message); // Assert controller.SayHello().Should().Be("hello from test"); }
public void Index() { // Arrange WelcomeController controller = new WelcomeController(); // Act ViewResult result = controller.Index() as ViewResult; // Assert Assert.IsNotNull(result); Assert.AreEqual("Home Page", result.ViewBag.Title); }
public void ShouldSaveUserSettings() { var state = new ConfigurationState(); InitForSucces(state); config.Stub(x => x.SaveConfigurate(state)).Repeat.Once(); mocks.ReplayAll(); var controller = new WelcomeController(factory); controller.TryShow(); }
public void LoginUserKnownUser() { WelcomeController controller = CreateController <WelcomeController>(); var qe = QuotesEntitySource.CreateQuotesEntity(); User user = qe.Users.First(u => !u.IsAdmin); RedirectToRouteResult rr = controller.LoginUser(user) as RedirectToRouteResult; Assert.IsNotNull(rr); Assert.AreEqual(user, controller.Session["User"]); Assert.AreEqual(2, rr.RouteValues.Count); Assert.AreEqual(rr.RouteValues["action"], "GetStarted"); Assert.AreEqual(rr.RouteValues["controller"], "Quotes"); }
public void ShouldNotShowViewIfShowWelcomeIsDisabled() { var state = new ConfigurationState { ShowWelcome = false }; factory.Stub(x => x.CreateWelcomeView()).Return(view); config.Stub(x => x.LoadConfiguration()).Repeat.Once().Return(state); view.Stub(x => x.ShowView()).Repeat.Never(); mocks.ReplayAll(); var controller = new WelcomeController(factory); controller.TryShow(); }
public void NewUserPostBack() { NewUser newUser = new NewUser { Username = "******", Password = "******", ReEnterPassword = "******" }; WelcomeController controller = CreateController <WelcomeController>(); var view = controller.NewUser(newUser); Assert.IsNotNull(view); Assert.IsTrue(QuotesEntitySource.MockQuotesEntity.ChangesSaved); Assert.IsTrue(QuotesEntitySource.MockQuotesEntity.IsDisposed); QuotesEntitySource.Reset(); var user = QuotesEntitySource.MockQuotesEntity.Users.FirstOrDefault(u => u.Username == newUser.Username && u.Password == newUser.Password); Assert.IsNotNull(user); }
public void ShouldReactToChangeLanguageEvent() { var state = new ConfigurationState(); InitForSucces(state); config.Stub(x => x.SaveConfigurate(state)).Repeat.Twice(); view.LanguageChanged += null; LastCall.Constraints(Is.NotNull()); IEventRaiser changeLangRaiser = LastCall.GetEventRaiser(); view.Stub(x => x.ResetLanguage()).Repeat.Once(); mocks.ReplayAll(); var controller = new WelcomeController(factory); controller.TryShow(); changeLangRaiser.Raise(null, null); }
public void TestAttributionTableGroup() { HotelMaster hotelMaster = new HotelMaster(); WelcomeController welcomeController = new WelcomeController(hotelMaster); Group group = welcomeController.CreateGroup(5); TableController tableController = new TableController(); Table table = tableController.OptimizedFindTable(hotelMaster.RankChiefs[0].Squares[0].Tables, group.Clients.Count); if (table == null) { table = tableController.OptimizedFindTable(hotelMaster.RankChiefs[1].Squares[0].Tables, group.Clients.Count); } Assert.IsNotNull(table); bool success = tableController.AttributionTableGroup(group, table); Assert.IsTrue(success); Assert.AreEqual(EquipmentState.InUse, table.State); Assert.AreEqual(GroupState.Ordering, group.State); }
public void SetUp() { hotelMaster = new HotelMaster(30, 40); welcomeController = new WelcomeController(hotelMaster); }
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { // create a new window instance based on the screen size Window = new UIWindow(UIScreen.MainScreen.Bounds); root = new WelcomeController(); nav = new UINavigationController(root); nav.NavigationBar.Translucent = false; var defaultNavBar = new UINavigationBar(); defaultNavBar.TintColor = UIColor.FromRGBA(0, 51, 102, 1f); // If you have defined a root view controller, set it here: Window.RootViewController = nav; // make the window visible Window.MakeKeyAndVisible(); // Below are instructions for initial setup, lines marked as optional // are options, lines marked as required are required // Throughout the code, you can search for [OPTIMIZELY] to find reference code // related to Optimizely // All lines that say [OPTIMIZELY] (REQUIRED) are necessary for you to // get started! // [OPTIMIZELY] (OPTIONAL) Add this line of code to debug issues. Please note that this line of code // should not be included when your app is in production OptimizelyiOS.Optimizely.SharedInstance.VerboseLogging = true; // [OPTIMIZELY] (OPTIONAL) Add this line of code if you would like to enable "Edit Mode" in your live app // Please note that adding this line will allow anyone to edit your app with // Optimizely in the app store // OptimizelyiOS.Optimizely.EnableGestureInAppStoreApp(); // [OPTIMIZELY] (OPTIONAL) Customize network call timing (By default network calls are made every 2 minutes) // OptimizelyiOS.Optimizely.SharedInstance.DispatchInterval = 120; // [OPTIMIZELY] (REQUIRED) Replace this line with your API token, and don't forget to go to // your target (i.e. the blue icon at the top that says TutorialApp) > Info > URL Types // Paste your Project ID there (e.g. it should look like optly123456, replace 123456 with your project id) // Replace @"AAMseu0A6cJKXYL7RiH_TgxkvTRMOCvS~123456" with your API Token from your Optimizely Dashboard // optimizely.com/dashboard // [OPTIMIZELY] (OPTIONAL) Google Analytics Example // https://help.optimizely.com/hc/en-us/articles/204628347 // Initialize Google Analytics prior to startOptimizely e.g. // id<GAITracker> tracker = [[GAI sharedInstance] trackerWithTrackingId:@"YOUR_GA_TRACKING_ID"]; var options = launchOptions ?? new NSDictionary(); OptimizelyiOS.Optimizely.StartOptimizelyWithAPIToken(@"AAM7hIkAowOlMm2aH9e1cYv_AztnhY25~3391160510", options); // [OPTIMIZELY] (OPTIONAL) Mixpanel Integration Instructions and order // Optimizely Mixpanel Integration goes here // Mixpanel Activation goes here // [OPTIMIZELY] (DEBUG) Subscribe to the OptimizelyExperimentVisitedNotification to know when an experiment // is visited, which means the visitor has see the experience you created NSNotificationCenter.DefaultCenter.AddObserver(this, new ObjCRuntime.Selector("ExperimentReceivedNotification"), OptimizelyiOS.Constants.OptimizelyExperimentVisitedNotification, null); // [OPTIMIZELY] (DEBUG) Subscribe to the OptimizelyNewDataFileLoadedNotification to know when // a new Optimizely data file has been updated NSNotificationCenter.DefaultCenter.AddObserver(this, new ObjCRuntime.Selector("DataFileReceivedNotification"), OptimizelyiOS.Constants.OptimizelyNewDataFileLoadedNotification, null); // [OPTIMIZELY] (DEBUG) Subscribe to the OptimizelyGoalTriggeredNotification to know when // a goal has triggered NSNotificationCenter.DefaultCenter.AddObserver(this, new ObjCRuntime.Selector("GoalReceivedNotification"), OptimizelyiOS.Constants.OptimizelyGoalTriggeredNotification, null); return(true); }