public void Constructor_Test_NotNull()
 {
     Assert.Throws <ArgumentNullException>(() =>
     {
         IAuth_Interactor auth_Interactor = new Auth_Interactor(null);
     });
 }
        public void Constructor_Test()
        {
            Mock <IDataWrap> mockDataWrap = new Mock <IDataWrap>(MockBehavior.Strict);

            Assert.DoesNotThrow(() =>
            {
                IAuth_Interactor auth_Interactor = new Auth_Interactor(mockDataWrap.Object);
            });
        }
        public void RegistrationPressed_Test()
        {
            Mock <IDataWrap>       mockDataWrap       = new Mock <IDataWrap>(MockBehavior.Strict);
            Mock <IAuth_Presenter> mockAuth_Presenter = new Mock <IAuth_Presenter>(MockBehavior.Strict);

            IAuth_Interactor auth_Interactor = new Auth_Interactor(mockDataWrap.Object);

            mockAuth_Presenter.Setup(a => a.GoToRegistration());
            auth_Interactor.Auth_Presenter = mockAuth_Presenter.Object;
            auth_Interactor.RegistrationPressed();
            mockAuth_Presenter.Verify(a => a.GoToRegistration(), 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);
            });
        }
Esempio n. 5
0
        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 OnSignInPressed_Event_Test_validation_False()
        {
            string                 login              = "******";
            string                 password           = "******";
            Mock <IDataWrap>       mockDataWrap       = new Mock <IDataWrap>(MockBehavior.Strict);
            Mock <IAuth_Presenter> mockAuth_Presenter = new Mock <IAuth_Presenter>(MockBehavior.Strict);

            IAuth_Interactor auth_Interactor = new Auth_Interactor(mockDataWrap.Object);

            mockAuth_Presenter.Setup(a => a.ErrorValidation());
            mockAuth_Presenter.Raise(a => a.OnSignInPressed += null);

            auth_Interactor.Auth_Presenter = mockAuth_Presenter.Object;

            object[] obj = new object[]
            {
                login, password
            };
            MethodInfo validate = typeof(Auth_Interactor).GetMethod("Validation", BindingFlags.Instance | BindingFlags.NonPublic);

            validate.Invoke(auth_Interactor, obj);
            auth_Interactor.SignInPressed(login, password);
            mockAuth_Presenter.Verify(a => a.ErrorValidation(), Times.Once);
        }