public void Configure() { var authenticationOptions = new AuthenticationOptions() { BaseUri = _klootzakkenWebUri }; var authenticationService = new AuthenticationService(authenticationOptions); var tempAuthTokenPoller = new TempAuthTokenPoller(authenticationService); var authenticationController = new AuthenticationController(authenticationService, tempAuthTokenPoller, _sharedPreferenceHander); SimpleIoc.Default.Register <AuthenticationController>(() => authenticationController); }
public void getTemporaryAuthTokenThrowsPinAuthenticationException_pollinForTemporaryAuthToken_throwsPinAuthException() { //ARRANGE var mockedAuthService = new Mock <IAuthenticationService>(); mockedAuthService.Setup(auth => auth.GetTemporaryAuthTokenAsync(It.IsAny <string>())).Throws(exepctedPinAuthenticationException); var sut = new TempAuthTokenPoller(mockedAuthService.Object); //ACT Func <Task> pollForTemporaryAuthTokenFunction = async() => await sut.poll(_pinCode, 1, 0); //ASSERT pollForTemporaryAuthTokenFunction.ShouldThrow <PinAuthenticationException>(); }
public void Configure() { var authenticationOptions = new AuthenticationOptions() { BaseUri = new Uri("http://www.glueware.nl/klootzakken/kz/") }; var authenticationService = new AuthenticationService(new AuthenticationOptions() { BaseUri = new Uri("http://www.glueware.nl/klootzakken/kz/") }); var tempAuthTokenPoller = new TempAuthTokenPoller(authenticationService); var authenticationController = new AuthenticationController(authenticationService, tempAuthTokenPoller, _sharedPreferenceHander); SimpleIoc.Default.Register <AuthenticationController>(() => authenticationController); }
public void getTemporaryAuthTokenReturnsTheToken_pollingForTemporaryAuthToken_returnTemporaryAuthToken() { //ARRANGE var mockedAuthenticationService = new Mock <IAuthenticationService>(); mockedAuthenticationService.Setup(auth => auth.GetTemporaryAuthTokenAsync(It.IsAny <string>())).ReturnsAsync(_tempAuthToken); var sut = new TempAuthTokenPoller(mockedAuthenticationService.Object); //ACT var tempAuthToken = sut.poll(_pinCode, 1, 0).Result; //ASSERT tempAuthToken.Should().BeAssignableTo <string>().And .BeSameAs(_tempAuthToken); }
public void getTemporaryAuthTokenThrowsExceptionsTillReachMaxNumberOfAttempts_pollingForTempAuthToken_returnsPinAuthenticationException() { //ARRANGE var mockedAuthenticationService = new Mock <IAuthenticationService>(); mockedAuthenticationService.SetupSequence(auth => auth.GetTemporaryAuthTokenAsync(It.IsAny <string>())) .Throws(exepctedPinAuthenticationException) .Throws(exepctedPinAuthenticationException) .Throws(exepctedPinAuthenticationException); var sut = new TempAuthTokenPoller(mockedAuthenticationService.Object); //ACT Func <Task> pollForTemporaryAuthTokenFunction = async() => await sut.poll(_pinCode, 3, 0); //ASSERT pollForTemporaryAuthTokenFunction.ShouldThrow <PinAuthenticationException>(); //TODO: return another exception }
protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.MainMenuView); //Arrange var authenticationOptions = new AuthenticationOptions() { BaseUri = new Uri("http://www.glueware.nl/klootzakken/kz/") }; var authenticationService = new AuthenticationService(authenticationOptions); var tempAuthTokenPoller = new TempAuthTokenPoller(authenticationService); var authenticationController = new AuthenticationController(authenticationService, tempAuthTokenPoller, new SharedPreferenceHandler()); //Act var pinCode = await authenticationController.GetPinCodeAsync(); //var tempAuthToken = await authenticationController.pollingForTemporaryAuthToken(pinCode, 5, 5000); //var bearerToken = await authenticationController.SaveBearerAuthTokenAsync(tempAuthToken); //Assert /*authParameters = new List<string> * { * "BearerToken - " + bearerToken * };*/ authParametersView = FindViewById <ListView>(Resource.Id.myGamesListView); authParametersView.Adapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, authParameters); Button createGame = FindViewById <Button>(Resource.Id.btnCreateGame); createGame.Click += delegate { StartActivity(typeof(MainActivity)); }; }