public void SetUp() { _fakeNavigationService = Substitute.For <INavigationService>(); _fakePageDialogService = Substitute.For <IPageDialogService>(); _fakeApiService = Substitute.For <IBackendApiService>(); _fakeSessionService = Substitute.For <ISessionService>(); _uut = new CreateCustomerViewModel(_fakeNavigationService, _fakePageDialogService, _fakeApiService, _fakeSessionService); _fakeHttpCreateCustomerSuccessResponse = new CreateCustomerResponse(new HttpResponseMessage() { StatusCode = HttpStatusCode.OK, Content = new StringContent("{\n \"token\": \"valid token\",\n \"customer\": {\n \"name\": \"customer name\",\n \"email\": \"[email protected]\",\n \"phoneNumber\": \"12345678\"\n }\n}", Encoding.UTF8, "application/json") }); _fakeHttpCreateCustomerBadRequestResponse = new CreateCustomerResponse(new HttpResponseMessage() { StatusCode = HttpStatusCode.BadRequest, Content = new StringContent("{\n\t\"token\": null,\n\t\"customer\": null,\n\t\"errors\": {\n\t\t\"error\": [\"Username already taken\"]\n\t}\n}", Encoding.UTF8, "application/json") }); _uut.Request.Email = "*****@*****.**"; _uut.Request.Name = "test tester"; _uut.Request.Password = "******"; _uut.Request.Password = "******"; _uut.Request.Phone = "12345678"; }
/// <summary> /// Initializes a new instance of the <see cref="T:i4prj.SmartCab.ViewModels.CreateCustomerViewModel"/> class. Dependencies auto injected. /// </summary> /// <param name="navigationService">Navigation service.</param> /// <param name="dialogService">Dialog service.</param> /// /// <param name="backendApiService">Backend Api Service.</param> public CreateCustomerViewModel(INavigationService navigationService, IPageDialogService dialogService, IBackendApiService backendApiService, ISessionService sessionService) : base(navigationService, dialogService) { Title = "Opret bruger"; Request = new CreateCustomerRequest(); _backendApiService = backendApiService; _sessionService = sessionService; }
/// <summary> /// Initializes a new instance of the <see cref="T:i4prj.SmartCab.ViewModels.LoginViewModel"/> class. Dependencies auto injected. /// </summary> /// <param name="navigationService">Navigation service.</param> /// <param name="dialogService">Dialog service.</param> /// <param name="backendApiService">Backend Api service.</param> public LoginViewModel(INavigationService navigationService, IPageDialogService dialogService, IBackendApiService backendApiService, ISessionService sessionService) : base(navigationService, dialogService) { Title = "Log ind"; Request = new LoginRequest(); _backendApiService = backendApiService; _sessionService = sessionService; }
public void SetUp() { // Fake uut (ViewModel) dependencies _fakeNavigationService = Substitute.For <INavigationService>(); _fakePageDialogService = Substitute.For <IPageDialogService>(); _fakeApiService = Substitute.For <IBackendApiService>(); _fakeSessionService = Substitute.For <ISessionService>(); // UUT _uut = new LoginViewModel(_fakeNavigationService, _fakePageDialogService, _fakeApiService, _fakeSessionService); }
/// <summary> /// Initializes a new instance of the <see cref="CreateRideViewModel"/> class. /// </summary> /// <param name="navigationService">Navigation service.</param> /// <param name="pageDialogService">Page dialog service.</param> public CreateRideViewModel(INavigationService navigationService, IPageDialogService pageDialogService, IBackendApiService backEndApiService) : base(navigationService, pageDialogService) { Title = "Opret tur"; Request = new CreateRideRequest(new TimeService()); _backendApiService = backEndApiService; Price = "Beregn min pris"; //TEST /* * Request.OriginCityName = "Aarhus V"; * Request.OriginPostalCode = "8210"; * Request.OriginStreetName = "Bispehavevej"; * Request.OriginStreetNumber = "3"; * Request.DestinationCityName = "Aarhus C"; * Request.DestinationPostalCode = "8000"; * Request.DestinationStreetName = "Banegårdspladsen"; * Request.DestinationStreetNumber = "1"; */ }
public void SetUp() { _fakeBackendApiService = Substitute.For <IBackendApiService>(); _fakeNavigationService = Substitute.For <INavigationService>(); _fakePageDialogService = Substitute.For <IPageDialogService>(); _uut = new CreateRideViewModel(_fakeNavigationService, _fakePageDialogService, _fakeBackendApiService); _priceResponseOk = new PriceResponse(new HttpResponseMessage() { StatusCode = HttpStatusCode.OK, Content = new StringContent(JsonConvert.SerializeObject(new { price = 100.00, }), Encoding.UTF8, "application/json"), }); _priceResponseBadRequest = new PriceResponse(new HttpResponseMessage() { StatusCode = HttpStatusCode.BadRequest, Content = new StringContent(JsonConvert.SerializeObject(new { errors = new Dictionary <string, IList <string> >() { { "error", new List <string> { "The address is not valid" } } }, }), Encoding.UTF8, "application/json"), }); _rideResponseOk = new CreateRideResponse(new HttpResponseMessage() { StatusCode = HttpStatusCode.OK, Content = new StringContent(JsonConvert.SerializeObject(new { id = 1, startDestination = new { cityName = "Test", postalCode = 1234, streetName = "Tester", streetNumber = 1 }, endDestination = new { cityName = "Tester", postalCode = 4321, streetName = "Test", streetNumber = 2 }, departureTime = DateTime.Now.Add(new TimeSpan(0, 0, 30)), confirmationDeadline = DateTime.Now.Subtract(new TimeSpan(0, 2, 0)), passengerCount = 1, createdOn = DateTime.Now, price = 100, status = 0, }), Encoding.UTF8, "application/json"), }); _rideResponseBadRequest = new CreateRideResponse(new HttpResponseMessage() { StatusCode = HttpStatusCode.BadRequest, Content = new StringContent(JsonConvert.SerializeObject(new { errors = new Dictionary <string, IList <string> >() { { "error", new List <string> { "Not enough money" } } }, }), Encoding.UTF8, "application/json"), }); }
public RidesViewModel(INavigationService navigationService, IPageDialogService dialogService, IBackendApiService backendApiService) : base(navigationService, dialogService) { Title = "Turoversigt"; _backendApiService = backendApiService; }