public void Constructor_Test_Null() { Assert.Throws <ArgumentNullException>(() => { IAuth_Presenter auth_Presenter = new Auth_Presenter(null, null); }); }
public void SetButtonRegistrationText_test() { Mock <IAuth_View> mockAuth_View = new Mock <IAuth_View>(MockBehavior.Strict); Mock <IRouter> mockRouter = new Mock <IRouter>(MockBehavior.Strict); Mock <ILocalization> mockLocalization = new Mock <ILocalization>(MockBehavior.Loose); IAuth_Presenter auth_Presenter = new Auth_Presenter(mockRouter.Object, mockAuth_View.Object); mockAuth_View.Setup(a => a.SetMainLabelText(It.IsAny <string>())); mockAuth_View.Setup(a => a.SetLabelLoginText(It.IsAny <string>())); mockAuth_View.Setup(a => a.SetLabelPasswordText(It.IsAny <string>())); mockAuth_View.Setup(a => a.SetButtonSignInText(It.IsAny <string>())); mockAuth_View.Setup(a => a.SetButtonRegistrationText(It.IsAny <string>())); mockAuth_View.Setup(a => a.SetExeptionMessage(It.IsAny <string>())); auth_Presenter.Localization = mockLocalization.Object; object[] obj = new object[] { mockLocalization.Object }; MethodInfo localChange = typeof(Auth_Presenter).GetMethod("SetLocalization", BindingFlags.Instance | BindingFlags.NonPublic); localChange.Invoke(auth_Presenter, obj); mockAuth_View.Verify(a => a.SetButtonRegistrationText(It.IsAny <string>()), Times.Once); }
public void Constructor_Test_NotNull() { Mock <IAuth_View> mockAuth_View = new Mock <IAuth_View>(MockBehavior.Strict); Mock <IRouter> mockRouter = new Mock <IRouter>(MockBehavior.Strict); Assert.DoesNotThrow(() => { IAuth_Presenter auth_Presenter = new Auth_Presenter(mockRouter.Object, mockAuth_View.Object); }); }
public void GoToRegistration_Test() { Mock <IAuth_View> mockAuth_View = new Mock <IAuth_View>(MockBehavior.Strict); Mock <IRouter> mockRouter = new Mock <IRouter>(MockBehavior.Strict); IAuth_Presenter auth_Presenter = new Auth_Presenter(mockRouter.Object, mockAuth_View.Object); mockRouter.Setup(a => a.GoRegistrationPage()); auth_Presenter.GoToRegistration(); mockRouter.Verify(a => a.GoRegistrationPage(), Times.Once); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); //var loginWindowView = FindViewById<RelativeLayout>(Resource.Id.loginWindow); EditText loginEditTextWindow = FindViewById <EditText>(Resource.Id.editText_user); EditText passwordEditTextWindow = FindViewById <EditText>(Resource.Id.editText_password); Switch switchButton = FindViewById <Switch>(Resource.Id.change_localization); Button signInButton = FindViewById <Button>(Resource.Id.button_signIn); Button registrationButton = FindViewById <Button>(Resource.Id.button_registration); TextView mainLabel = FindViewById <TextView>(Resource.Id.textView_main); TextView loginLabel = FindViewById <TextView>(Resource.Id.textView_username); TextView passwordLabel = FindViewById <TextView>(Resource.Id.textView_password); TextView textViewExeption = FindViewById <TextView>(Resource.Id.textViewException); IDataWrap dataWrap = new DataWrap(); IRouter router = new AndroidRouter(this); IAuth_Presenter auth_Presenter = new Auth_Presenter(router, this); auth_Presenter.Router = router; IAuth_Interactor auth_Intarector = new Auth_Interactor(dataWrap); auth_Intarector.Auth_Presenter = auth_Presenter; switchButton.Click += ((o, e) => { var click = (Switch)o; ChangeLocalizationClick?.Invoke(click.Checked); }); registrationButton.Click += ((o, e) => { OnRegistrationClick?.Invoke(); }); signInButton.Click += ((o, e) => { string login = loginEditTextWindow.Text; string password = passwordEditTextWindow.Text; OnSignInClick?.Invoke(login, password); }); }
public override void ViewDidLoad() { base.ViewDidLoad(); IDataWrap dataWrap = new DataWrap(); IRouter router = new IOSRouter(NavigationController); IAuth_Presenter auth_Presenter = new Auth_Presenter(router, this); auth_Presenter.Router = router; IAuth_Interactor auth_Intarector = new Auth_Interactor(dataWrap); auth_Intarector.Auth_Presenter = auth_Presenter; signInButton.TouchUpInside += SignInButton_TouchUpInside; registrationButton.TouchUpInside += RegistrationButton_TouchUpInside; localizationChangeButton.TouchUpInside += LocalizationChangeButton_TouchUpInside; }
public void SetLabelLoginText_Test() { Mock <IAuth_View> mockAuth_View = new Mock <IAuth_View>(MockBehavior.Strict); Mock <IRouter> mockRouter = new Mock <IRouter>(MockBehavior.Strict); IAuth_Presenter auth_Presenter = new Auth_Presenter(mockRouter.Object, mockAuth_View.Object); mockAuth_View.Setup(a => a.SetLabelLoginText(It.IsAny <string>())); mockAuth_View.Setup(a => a.SetLabelPasswordText(It.IsAny <string>())); mockAuth_View.Setup(a => a.SetButtonSignInText(It.IsAny <string>())); mockAuth_View.Setup(a => a.SetButtonRegistrationText(It.IsAny <string>())); //object[] answer = new object[] //{ // true //}; //MethodInfo localChange = typeof(Auth_Presenter).GetMethod("_auth_View_ChangeLocalizationClick", BindingFlags.Instance | BindingFlags.NonPublic); //localChange.Invoke(auth_Presenter, answer); }