diff --git a/LastenradBayern/TINK.Android/Properties/AndroidManifest.xml b/LastenradBayern/TINK.Android/Properties/AndroidManifest.xml index 975753a..c2deab7 100644 --- a/LastenradBayern/TINK.Android/Properties/AndroidManifest.xml +++ b/LastenradBayern/TINK.Android/Properties/AndroidManifest.xml @@ -1,5 +1,5 @@  - + diff --git a/LastenradBayern/TINK.Android/Resources/Resource.Designer.cs b/LastenradBayern/TINK.Android/Resources/Resource.Designer.cs index 3275cbd..daf0276 100644 --- a/LastenradBayern/TINK.Android/Resources/Resource.Designer.cs +++ b/LastenradBayern/TINK.Android/Resources/Resource.Designer.cs @@ -14,7 +14,7 @@ namespace TINK.Droid { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "13.0.0.73")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "13.2.0.93")] public partial class Resource { diff --git a/LastenradBayern/TINK.iOS/Info.plist b/LastenradBayern/TINK.iOS/Info.plist index b4cc507..bd58ee7 100644 --- a/LastenradBayern/TINK.iOS/Info.plist +++ b/LastenradBayern/TINK.iOS/Info.plist @@ -56,8 +56,8 @@ CFBundleDisplayName LastenradBayern CFBundleVersion - 360 + 361 CFBundleShortVersionString - 3.0.360 + 3.0.361 diff --git a/Meinkonrad/TINK.Android/Properties/AndroidManifest.xml b/Meinkonrad/TINK.Android/Properties/AndroidManifest.xml index 50cf382..e6aea39 100644 --- a/Meinkonrad/TINK.Android/Properties/AndroidManifest.xml +++ b/Meinkonrad/TINK.Android/Properties/AndroidManifest.xml @@ -1,5 +1,5 @@  - + diff --git a/Meinkonrad/TINK.Android/Resources/Resource.Designer.cs b/Meinkonrad/TINK.Android/Resources/Resource.Designer.cs index cf3fffb..67a528c 100644 --- a/Meinkonrad/TINK.Android/Resources/Resource.Designer.cs +++ b/Meinkonrad/TINK.Android/Resources/Resource.Designer.cs @@ -14,7 +14,7 @@ namespace TINK.Droid { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "13.0.0.73")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "13.2.0.93")] public partial class Resource { diff --git a/Meinkonrad/TINK.iOS/Info.plist b/Meinkonrad/TINK.iOS/Info.plist index 7fa2cb0..8f69fb4 100644 --- a/Meinkonrad/TINK.iOS/Info.plist +++ b/Meinkonrad/TINK.iOS/Info.plist @@ -56,8 +56,8 @@ CFBundleDisplayName Mein konrad CFBundleVersion - 360 + 361 CFBundleShortVersionString - 3.0.360 + 3.0.361 diff --git a/Meinkonrad/TINK/View/Bike/ILockItBike.xaml b/Meinkonrad/TINK/View/Bike/ILockItBike.xaml index 60ea2bf..35acb27 100644 --- a/Meinkonrad/TINK/View/Bike/ILockItBike.xaml +++ b/Meinkonrad/TINK/View/Bike/ILockItBike.xaml @@ -12,217 +12,231 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + @@ -122,9 +215,8 @@ - - + diff --git a/Meinkonrad/TINK/View/Map/MapPage.xaml.cs b/Meinkonrad/TINK/View/Map/MapPage.xaml.cs index 712326e..5f1c4aa 100644 --- a/Meinkonrad/TINK/View/Map/MapPage.xaml.cs +++ b/Meinkonrad/TINK/View/Map/MapPage.xaml.cs @@ -175,16 +175,6 @@ namespace TINK.View.Map return; } - try - { - ApplyCustomiOSStyling(); - } - catch (Exception exception) - { - // Continue because styling is not essential. - Log.ForContext().Error("IOS specific styling of map page failed. {Exception}", exception); - } - try { base.OnAppearing(); @@ -250,22 +240,6 @@ namespace TINK.View.Map Navigation); } - /// - /// Applies iOS specific styling to branded Buttons. - /// - private void ApplyCustomiOSStyling() - { - if (Device.RuntimePlatform == Device.iOS) - { - TINKButton.BackgroundColor = Color.LightGray; - TINKButton.BorderColor = Color.Black; - TINKButton.Margin = new Thickness(10, 10, 10, 10); - KonradButton.BackgroundColor = Color.LightGray; - KonradButton.BorderColor = Color.Black; - KonradButton.Margin = new Thickness(10, 10, 10, 10); - } - } - /// /// Invoked when pages is closed/ hidden. /// Stops update process. diff --git a/Meinkonrad/TINK/View/MyBikes/MyBikesPage.xaml b/Meinkonrad/TINK/View/MyBikes/MyBikesPage.xaml index 91c4f2e..ca73a1f 100644 --- a/Meinkonrad/TINK/View/MyBikes/MyBikesPage.xaml +++ b/Meinkonrad/TINK/View/MyBikes/MyBikesPage.xaml @@ -6,7 +6,9 @@ xmlns:resources="clr-namespace:TINK.MultilingualResources;assembly=TINKLib" xmlns:sharedGui="clr-namespace:ShareeSharedGuiLib.View" xmlns:local_bike="clr-namespace:TINK.View.Bike" - Shell.FlyoutBehavior="{Binding FlyoutBehavior}"> + BackgroundColor="{DynamicResource background-color}" + Shell.FlyoutBehavior="{Binding FlyoutBehavior}" + > @@ -16,6 +18,7 @@ + @@ -27,59 +30,75 @@ - + + - - + - + + - - - - - + - - + + - - + - - - - - - + - + diff --git a/TINK/TINK.Android/Properties/AndroidManifest.xml b/TINK/TINK.Android/Properties/AndroidManifest.xml index ce2c57c..33f9f49 100644 --- a/TINK/TINK.Android/Properties/AndroidManifest.xml +++ b/TINK/TINK.Android/Properties/AndroidManifest.xml @@ -1,5 +1,5 @@  - + diff --git a/TINK/TINK.Android/Resources/Resource.Designer.cs b/TINK/TINK.Android/Resources/Resource.Designer.cs index 1ace544..7358aaf 100644 --- a/TINK/TINK.Android/Resources/Resource.Designer.cs +++ b/TINK/TINK.Android/Resources/Resource.Designer.cs @@ -14,7 +14,7 @@ namespace TINK.Droid { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "13.0.0.73")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "13.2.0.93")] public partial class Resource { diff --git a/TINK/TINK.iOS/Info.plist b/TINK/TINK.iOS/Info.plist index d9d4a22..8ba33f9 100644 --- a/TINK/TINK.iOS/Info.plist +++ b/TINK/TINK.iOS/Info.plist @@ -56,8 +56,8 @@ CFBundleDisplayName sharee.bike CFBundleVersion - 360 + 361 CFBundleShortVersionString - 3.0.360 + 3.0.361 diff --git a/TINK/TINK/View/BikesAtStation/BikesAtStationPage.xaml b/TINK/TINK/View/BikesAtStation/BikesAtStationPage.xaml index 4ea0c9a..6101105 100644 --- a/TINK/TINK/View/BikesAtStation/BikesAtStationPage.xaml +++ b/TINK/TINK/View/BikesAtStation/BikesAtStationPage.xaml @@ -7,7 +7,7 @@ xmlns:resources="clr-namespace:TINK.MultilingualResources;assembly=TINKLib" xmlns:sharedGui="clr-namespace:ShareeSharedGuiLib.View" Shell.FlyoutBehavior="Disabled" - BackgroundColor="#f6f6f6" + BackgroundColor="{DynamicResource background-color}" Shell.NavBarIsVisible="{Binding IsIdle}"> @@ -28,9 +28,11 @@ - - + + + BackgroundColor="{DynamicResource primary-back-title-color}" + IsVisible="{Binding IsIdle}" + Padding="20,0,20,0"> + HeightRequest="1" + WidthRequest="400" + HorizontalOptions="Center" + Color="White"/> - - @@ -68,73 +94,89 @@ - + - diff --git a/TINK/TINK/View/Map/MapPage.xaml b/TINK/TINK/View/Map/MapPage.xaml index e3dd21f..ab2273d 100644 --- a/TINK/TINK/View/Map/MapPage.xaml +++ b/TINK/TINK/View/Map/MapPage.xaml @@ -7,7 +7,7 @@ x:Class="TINK.View.Map.MapPage" xmlns:sharedGui="clr-namespace:ShareeSharedGuiLib.View" Shell.NavBarIsVisible="{Binding IsNavBarVisible}" - BackgroundColor="{DynamicResource Key=primary-back-title-color}"> + BackgroundColor="{DynamicResource Key=background-color}"> @@ -28,8 +28,9 @@ @@ -49,7 +50,7 @@ - - - - - - + + + - - + + + + diff --git a/TINK/TINK/View/Map/MapPage.xaml.cs b/TINK/TINK/View/Map/MapPage.xaml.cs index 712326e..5f1c4aa 100644 --- a/TINK/TINK/View/Map/MapPage.xaml.cs +++ b/TINK/TINK/View/Map/MapPage.xaml.cs @@ -175,16 +175,6 @@ namespace TINK.View.Map return; } - try - { - ApplyCustomiOSStyling(); - } - catch (Exception exception) - { - // Continue because styling is not essential. - Log.ForContext().Error("IOS specific styling of map page failed. {Exception}", exception); - } - try { base.OnAppearing(); @@ -250,22 +240,6 @@ namespace TINK.View.Map Navigation); } - /// - /// Applies iOS specific styling to branded Buttons. - /// - private void ApplyCustomiOSStyling() - { - if (Device.RuntimePlatform == Device.iOS) - { - TINKButton.BackgroundColor = Color.LightGray; - TINKButton.BorderColor = Color.Black; - TINKButton.Margin = new Thickness(10, 10, 10, 10); - KonradButton.BackgroundColor = Color.LightGray; - KonradButton.BorderColor = Color.Black; - KonradButton.Margin = new Thickness(10, 10, 10, 10); - } - } - /// /// Invoked when pages is closed/ hidden. /// Stops update process. diff --git a/TINK/TINK/View/MyBikes/MyBikesPage.xaml b/TINK/TINK/View/MyBikes/MyBikesPage.xaml index 032f457..aff8ed8 100644 --- a/TINK/TINK/View/MyBikes/MyBikesPage.xaml +++ b/TINK/TINK/View/MyBikes/MyBikesPage.xaml @@ -6,7 +6,7 @@ xmlns:resources="clr-namespace:TINK.MultilingualResources;assembly=TINKLib" xmlns:sharedGui="clr-namespace:ShareeSharedGuiLib.View" xmlns:local_bike="clr-namespace:TINK.View.Bike" - BackgroundColor="#f6f6f6" + BackgroundColor="{DynamicResource background-color}" Shell.FlyoutBehavior="{Binding FlyoutBehavior}"> @@ -30,6 +30,7 @@ - - - + TextColor="DimGray" + Padding="5" + HorizontalOptions="CenterAndExpand"> + + + + + + + + + diff --git a/TINKLib/Model/WhatsNew.cs b/TINKLib/Model/WhatsNew.cs index 6d78434..6fbd728 100644 --- a/TINKLib/Model/WhatsNew.cs +++ b/TINKLib/Model/WhatsNew.cs @@ -676,6 +676,11 @@ namespace TINK.Model new Version(3, 0, 360), AppResources.ChangeLog_3_0_358_MK_SB, new List { AppFlavor.MeinKonrad, AppFlavor.ShareeBike } + }, + { + new Version(3, 0, 361), + AppResources.ChangeLog_3_0_361_MK_SB, + new List { AppFlavor.MeinKonrad, AppFlavor.ShareeBike } }, }; diff --git a/TINKLib/MultilingualResources/AppResources.Designer.cs b/TINKLib/MultilingualResources/AppResources.Designer.cs index d9d3c08..7636d4c 100644 --- a/TINKLib/MultilingualResources/AppResources.Designer.cs +++ b/TINKLib/MultilingualResources/AppResources.Designer.cs @@ -757,6 +757,15 @@ namespace TINK.MultilingualResources { } } + /// + /// Looks up a localized string similar to If you have reserved or rented a bike, this will now be shown to you as an icon on the map page. Clicking on it will take you directly to the 'My bikes' page. We have also made small design changes.. + /// + public static string ChangeLog_3_0_361_MK_SB { + get { + return ResourceManager.GetString("ChangeLog_3_0_361_MK_SB", resourceCulture); + } + } + /// /// Looks up a localized string similar to We have fixed some bugs. Enjoy the ride!. /// @@ -1873,7 +1882,7 @@ namespace TINK.MultilingualResources { } /// - /// Looks up a localized string similar to Station id: {0}. + /// Looks up a localized string similar to ID: {0}. /// public static string MarkingBikesAtStationStationId { get { @@ -1945,7 +1954,7 @@ namespace TINK.MultilingualResources { } /// - /// Looks up a localized string similar to <font color="blue"><u>Contact</u></font> {0}.. + /// Looks up a localized string similar to <u>Contact</u> {0}.. /// public static string MarkingContactSupport { get { diff --git a/TINKLib/MultilingualResources/AppResources.de.resx b/TINKLib/MultilingualResources/AppResources.de.resx index 5ddfed1..f90f00a 100644 --- a/TINKLib/MultilingualResources/AppResources.de.resx +++ b/TINKLib/MultilingualResources/AppResources.de.resx @@ -599,7 +599,7 @@ Layout Anzeige Radnamen und nummern verbessert. Wahl eines Rads über die Radnummer hinzugefügt. - {0} <font color="blue"><u>kontaktieren</u></font>. + {0} <u>kontaktieren</u>. Bitte Anmelden um Fahrräder zu reservieren! <font color="blue"><u>Hier</u></font> tippen, um auf Anmeldeseite zu wechseln. @@ -694,7 +694,7 @@ Kleinere Verbesserungen. Komponenten von Fremdanbietern aktualisiert. - Stationskennung: {0} + ID: {0} Anzeige Stationskennung. @@ -1140,4 +1140,7 @@ Wenn sich das Schloss weiterhin nicht öffnen lässt, vergewissern Sie sich, das Neue Funktionen:<ul><li>Wenn Ihr Gerät nicht mit dem Internet verbunden ist, wird dies nun oben angezeigt.</li><li>Sie können jetzt Ihre Fahrradansicht aktualisieren, indem Sie von oben nach unten ziehen. Das ist besonders nützlich, wenn Sie sich wieder mit dem Internet verbunden haben.</li></ul> <br/>Außerdem:<ul><li>Software Pakete wurde aktualisiert.</li><li>Kleinere Fehlerbehebungen.</li></ul> + + Wenn Sie ein Rad reserviert oder gemietet haben, wird dies Ihnen nun auf der Kartenseite als Symbol angezeigt. Ein Klick darauf führt Sie direkt zur Seite 'Meine Räder'. Wir haben außerdem kleine Designänderungen vorgenommen. + \ No newline at end of file diff --git a/TINKLib/MultilingualResources/AppResources.resx b/TINKLib/MultilingualResources/AppResources.resx index 87254f0..b35f71f 100644 --- a/TINKLib/MultilingualResources/AppResources.resx +++ b/TINKLib/MultilingualResources/AppResources.resx @@ -717,7 +717,7 @@ Layout of bike names and id display improved. Contact operator? - <font color="blue"><u>Contact</u></font> {0}. + <u>Contact</u> {0}. Please login to reserve bikes! Tap <font color="blue"><u>here</u></font> to switch to login page. @@ -802,7 +802,7 @@ Minor fixes. Third-party components updated. - Station id: {0} + ID: {0} Station id displayed. @@ -1230,4 +1230,7 @@ Try it out! Oops, there is no internet connection. + + If you have reserved or rented a bike, this will now be shown to you as an icon on the map page. Clicking on it will take you directly to the 'My bikes' page. We have also made small design changes. + \ No newline at end of file diff --git a/TINKLib/MultilingualResources/TINKLib.de.xlf b/TINKLib/MultilingualResources/TINKLib.de.xlf index 4d92614..25ce770 100644 --- a/TINKLib/MultilingualResources/TINKLib.de.xlf +++ b/TINKLib/MultilingualResources/TINKLib.de.xlf @@ -802,8 +802,8 @@ Layout Anzeige Radnamen und nummern verbessert. Wahl eines Rads über die Radnummer hinzugefügt. - <font color="blue"><u>Contact</u></font> {0}. - {0} <font color="blue"><u>kontaktieren</u></font>. + <u>Contact</u> {0}. + {0} <u>kontaktieren</u>. Please login to reserve bikes! Tap <font color="blue"><u>here</u></font> to switch to login page. @@ -929,8 +929,8 @@ Kleinere Verbesserungen. Komponenten von Fremdanbietern aktualisiert. - Station id: {0} - Stationskennung: {0} + ID: {0} + ID: {0} Station id displayed. @@ -1562,6 +1562,10 @@ Wenn sich das Schloss weiterhin nicht öffnen lässt, vergewissern Sie sich, das Neue Funktionen:<ul><li>Wenn Ihr Gerät nicht mit dem Internet verbunden ist, wird dies nun oben angezeigt.</li><li>Sie können jetzt Ihre Fahrradansicht aktualisieren, indem Sie von oben nach unten ziehen. Das ist besonders nützlich, wenn Sie sich wieder mit dem Internet verbunden haben.</li></ul> <br/>Außerdem:<ul><li>Software Pakete wurde aktualisiert.</li><li>Kleinere Fehlerbehebungen.</li></ul> + + If you have reserved or rented a bike, this will now be shown to you as an icon on the map page. Clicking on it will take you directly to the 'My bikes' page. We have also made small design changes. + Wenn Sie ein Rad reserviert oder gemietet haben, wird dies Ihnen nun auf der Kartenseite als Symbol angezeigt. Ein Klick darauf führt Sie direkt zur Seite 'Meine Räder'. Wir haben außerdem kleine Designänderungen vorgenommen. + diff --git a/TINKLib/Repository/CopriCallsMemory.cs b/TINKLib/Repository/CopriCallsMemory.cs index 9fa4bb9..6f58000 100644 --- a/TINKLib/Repository/CopriCallsMemory.cs +++ b/TINKLib/Repository/CopriCallsMemory.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Threading.Tasks; using TINK.Model.Bikes.BikeInfoNS.BluetoothLock; using TINK.Model.Connector; -using TINK.Model.Device; using TINK.Repository.Request; using TINK.Repository.Response; diff --git a/TINKLib/View/Themes/Konrad.xaml b/TINKLib/View/Themes/Konrad.xaml index ed37b0f..9f5f504 100644 --- a/TINKLib/View/Themes/Konrad.xaml +++ b/TINKLib/View/Themes/Konrad.xaml @@ -9,6 +9,9 @@ #FF0020 + + #BEBEBE + #06D1B1 diff --git a/TINKLib/View/Themes/ShareeBike.xaml b/TINKLib/View/Themes/ShareeBike.xaml index 8857381..928a84a 100644 --- a/TINKLib/View/Themes/ShareeBike.xaml +++ b/TINKLib/View/Themes/ShareeBike.xaml @@ -6,6 +6,9 @@ #009899 + + #BEBEBE + #FC870D diff --git a/TINKLib/ViewModel/Bikes/BikesViewModel.cs b/TINKLib/ViewModel/Bikes/BikesViewModel.cs index 3ee4cc1..ca22487 100644 --- a/TINKLib/ViewModel/Bikes/BikesViewModel.cs +++ b/TINKLib/ViewModel/Bikes/BikesViewModel.cs @@ -387,6 +387,11 @@ namespace TINK.ViewModel.Bikes return Exception.GetShortErrorInfoText(IsReportLevelVerbose); } + if (!IsConnected) + { + return AppResources.ActivityTextConnectionStateOffline; + } + return ActionText ?? string.Empty; } } diff --git a/TINKLib/ViewModel/Map/MapPageViewModel.cs b/TINKLib/ViewModel/Map/MapPageViewModel.cs index 558ebbf..78cfb51 100644 --- a/TINKLib/ViewModel/Map/MapPageViewModel.cs +++ b/TINKLib/ViewModel/Map/MapPageViewModel.cs @@ -27,6 +27,11 @@ using TINK.Repository; using TINK.Services.Geolocation; using TINK.Model.State; using TINK.ViewModel.Bikes; +using Location = Xamarin.Essentials.Location; + + + + @@ -238,31 +243,38 @@ namespace TINK.ViewModel.Map { Log.ForContext().Debug($"Starting update of stations pins color for {stationsColorList.Count} stations..."); + int MyBikesCount = 0; // Update colors of pins. for (int pinIndex = 0; pinIndex < stationsColorList.Count; pinIndex++) { - var indexPartPrefix = int.TryParse(Pins[pinIndex].Tag.ToString(), out int stationId) - && stationId <= CUSTOM_ICONS_COUNT - ? $"{stationId}" // there is a station marker with index letter for given station id - : "Open"; // there is no station marker. Use open marker. + var indexPartPrefix = int.TryParse(Pins[pinIndex].Tag.ToString(), out int stationId) + && stationId <= CUSTOM_ICONS_COUNT + ? $"{stationId}" // there is a station marker with index letter for given station id + : "Open"; // there is no station marker. Use open marker. - var colorPartPrefix = GetRessourceNameColorPart(stationsColorList[pinIndex]); + var colorPartPrefix = GetRessourceNameColorPart(stationsColorList[pinIndex]); + if (colorPartPrefix == "Blue" || colorPartPrefix == "LightBlue") + { + MyBikesCount = MyBikesCount + 1; + }; - var name = $"{indexPartPrefix.ToString().PadLeft(2, '0')}_{colorPartPrefix}{(DeviceInfo.Platform == DevicePlatform.Android ? ".png" : string.Empty)}"; - try - { - Pins[pinIndex].Icon = BitmapDescriptorFactory.FromBundle(name); - } - catch (Exception excption) - { - Log.ForContext().Error("Station icon {name} can not be loaded. {@excption}.", name, excption); - Pins[pinIndex].Label = stationId.ToString(); - Pins[pinIndex].Icon = BitmapDescriptorFactory.DefaultMarker(stationsColorList[pinIndex]); - } + var name = $"{indexPartPrefix.ToString().PadLeft(2, '0')}_{colorPartPrefix}{(DeviceInfo.Platform == DevicePlatform.Android ? ".png" : string.Empty)}"; + try + { + Pins[pinIndex].Icon = BitmapDescriptorFactory.FromBundle(name); + } + catch (Exception excption) + { + Log.ForContext().Error("Station icon {name} can not be loaded. {@excption}.", name, excption); + Pins[pinIndex].Label = stationId.ToString(); + Pins[pinIndex].Icon = BitmapDescriptorFactory.DefaultMarker(stationsColorList[pinIndex]); + } Pins[pinIndex].IsVisible = true; } + MyBikesCountText = MyBikesCount > 0 ? string.Format(MyBikesCount.ToString()) : string.Empty; + var pinsCount = Pins.Count; for (int pinIndex = stationsColorList.Count; pinIndex < pinsCount; pinIndex++) { @@ -273,6 +285,20 @@ namespace TINK.ViewModel.Map Log.ForContext().Debug("Update of stations pins color done."); } + /// + /// label for number of reserved/rented bikes; + /// + private string _myBikesCountText = string.Empty; + public string MyBikesCountText + { + get { return _myBikesCountText; } + set + { + _myBikesCountText = value; + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(MyBikesCountText))); + } + } + /// Gets the color related part of the ressrouce name. /// Color to get name for. /// Resource name. @@ -340,7 +366,7 @@ namespace TINK.ViewModel.Map { // Context switch should not be required because code is called from GUI thread // but a xf-issue requires call (see issue #594). - TinkApp.PostAction( async (x) => + TinkApp.PostAction(async (x) => { // Show COPRI message once. await ViewService.DisplayAlert( @@ -376,11 +402,11 @@ namespace TINK.ViewModel.Map { var status = await PermissionsService.CheckStatusAsync(); if (status == Status.Granted) - { - // Get from smart device - mapSpan = await GetFromLocationService(status); - } + { + // Get from smart device + mapSpan = await GetFromLocationService(status); } + } if (mapSpan == null) { @@ -462,16 +488,16 @@ namespace TINK.ViewModel.Map { if (Pins.Count > 0 && Pins.Count != stations.Count) { - // Either - // - user logged in/ logged out which might lead to more/ less stations beeing available - // - new stations were added/ existing ones remove - Pins.Clear(); + // Either + // - user logged in/ logged out which might lead to more/ less stations beeing available + // - new stations were added/ existing ones remove + Pins.Clear(); } // Check if there are alreay any pins to the map // i.e detecte first call of member OnAppearing after construction if (Pins.Count <= 0) - { + { Log.ForContext().Debug($"{(ActiveFilterMap.GetGroup().Any() ? $"Active map filter is {string.Join(",", ActiveFilterMap.GetGroup())}." : "Map filter is off.")}"); // Map was not yet initialized. @@ -546,15 +572,15 @@ namespace TINK.ViewModel.Map AppResources.MessageAnswerYes, AppResources.MessageAnswerNo); - if (dialogResult) - { - // User decided to give access to locations permissions. - PermissionsService.OpenAppSettings(); - ActionText = string.Empty; - IsProcessWithRunningProcessView = false; - IsNavBarVisible = true; - IsMapPageEnabled = true; - } + if (dialogResult) + { + // User decided to give access to locations permissions. + PermissionsService.OpenAppSettings(); + ActionText = string.Empty; + IsProcessWithRunningProcessView = false; + IsNavBarVisible = true; + IsMapPageEnabled = true; + } } return status; } @@ -661,40 +687,40 @@ namespace TINK.ViewModel.Map /// Id of station user clicked on. public async void OnStationClicked(string selectedStationId) { - try - { - Log.ForContext().Information($"User taped station {selectedStationId}."); + try + { + Log.ForContext().Information($"User taped station {selectedStationId}."); - // Lock action to prevent multiple instances of "BikeAtStation" being opened. - IsMapPageEnabled = false; + // Lock action to prevent multiple instances of "BikeAtStation" being opened. + IsMapPageEnabled = false; - TinkApp.SelectedStation = TinkApp.Stations.FirstOrDefault(x => x.Id == selectedStationId) - ?? new Station(selectedStationId, new List(), null); // Station might not be in list StationDictinaly because this list is not updatd in background task. + TinkApp.SelectedStation = TinkApp.Stations.FirstOrDefault(x => x.Id == selectedStationId) + ?? new Station(selectedStationId, new List(), null); // Station might not be in list StationDictinaly because this list is not updatd in background task. #if TRYNOTBACKSTYLE m_oNavigation.ShowPage( typeof(BikesAtStationPage), p_strStationName); #else - { - // Show page. - await ViewService.PushAsync(ViewTypes.BikesAtStation); - - IsMapPageEnabled = true; - ActionText = string.Empty; - } - } - catch (Exception exception) { + // Show page. + await ViewService.PushAsync(ViewTypes.BikesAtStation); + IsMapPageEnabled = true; ActionText = string.Empty; - - Log.ForContext().Error("Fehler beim Öffnen der Ansicht \"Fahrräder an Station\" aufgetreten. {Exception}", exception); - await ViewService.DisplayAlert( - "Fehler", - $"Fehler beim Öffnen der Ansicht \"Fahrräder an Station\" aufgetreten. {exception.Message}", - "OK"); } + } + catch (Exception exception) + { + IsMapPageEnabled = true; + ActionText = string.Empty; + + Log.ForContext().Error("Fehler beim Öffnen der Ansicht \"Fahrräder an Station\" aufgetreten. {Exception}", exception); + await ViewService.DisplayAlert( + "Fehler", + $"Fehler beim Öffnen der Ansicht \"Fahrräder an Station\" aufgetreten. {exception.Message}", + "OK"); + } #endif } @@ -858,11 +884,44 @@ namespace TINK.ViewModel.Map // An error occurred getting data from copri. return Exception.GetShortErrorInfoText(TinkApp.IsReportLevelVerbose); } + if (!IsConnected) + { + return AppResources.ActivityTextConnectionStateOffline; + } return ActionText ?? string.Empty; } } + /// Processes request to view my bikes. + public System.Windows.Input.ICommand OnMyBikesButtonClicked => new Xamarin.Forms.Command(async () => + { + try + { + Log.ForContext().Information($"User clicked on MyBikesButton."); + + // Lock action to prevent multiple instances of "BikeAtStation" being opened. + IsMapPageEnabled = false; + + // Show page. + await ViewService.PushAsync(ViewTypes.MyBikesPage); + + IsMapPageEnabled = true; + ActionText = string.Empty; + } + catch (Exception exception) + { + IsMapPageEnabled = true; + ActionText = string.Empty; + + Log.ForContext().Error("Fehler beim Öffnen der Ansicht \"Meine Räder\" aufgetreten. {Exception}", exception); + await ViewService.DisplayAlert( + "Fehler", + $"Fehler beim Öffnen der Ansicht \"Meine Räder\" aufgetreten. {exception.Message}", + "OK"); + } + }); + /// Command object to bind login button to view model. public System.Windows.Input.ICommand OnToggleTinkToKonrad => new Xamarin.Forms.Command(async () => await ToggleTinkToKonrad()); diff --git a/TestFramework/Services/CopriApi/CopriCallsCacheMemory001.cs b/TestFramework/Services/CopriApi/CopriCallsCacheMemory001.cs index 6abd1f9..f84ed67 100644 --- a/TestFramework/Services/CopriApi/CopriCallsCacheMemory001.cs +++ b/TestFramework/Services/CopriApi/CopriCallsCacheMemory001.cs @@ -4,7 +4,6 @@ using System.Threading.Tasks; using TestFramework.Repository; using TINK.Model.Bikes.BikeInfoNS.BluetoothLock; using TINK.Model.Connector; -using TINK.Model.Device; using TINK.Model.Services.CopriApi; using TINK.Repository.Request; using TINK.Repository.Response; diff --git a/TestTINKLib/Fixtures/ObjectTests/Settings/BluetoothLock/TestLockIt.cs b/TestLockItBLE/Services/BluetoothLock/BLE/TestLockIt.cs similarity index 100% rename from TestTINKLib/Fixtures/ObjectTests/Settings/BluetoothLock/TestLockIt.cs rename to TestLockItBLE/Services/BluetoothLock/BLE/TestLockIt.cs diff --git a/TestTINKLib/Fixtures/ObjectTests/Connector/Filter/TestIntersectFilter.cs b/TestShareeLib/Model/Connector/Filter/TestIntersectFilter.cs similarity index 100% rename from TestTINKLib/Fixtures/ObjectTests/Connector/Filter/TestIntersectFilter.cs rename to TestShareeLib/Model/Connector/Filter/TestIntersectFilter.cs diff --git a/TestTINKLib/Fixtures/ObjectTests/Connector/Filter/TestNullFilter.cs b/TestShareeLib/Model/Connector/Filter/TestNullFilter.cs similarity index 100% rename from TestTINKLib/Fixtures/ObjectTests/Connector/Filter/TestNullFilter.cs rename to TestShareeLib/Model/Connector/Filter/TestNullFilter.cs diff --git a/TestShareeLib/Model/Connector/TestCopriProviderHttps.cs b/TestShareeLib/Model/Connector/TestCopriProviderHttps.cs index 7d85279..b5f926b 100644 --- a/TestShareeLib/Model/Connector/TestCopriProviderHttps.cs +++ b/TestShareeLib/Model/Connector/TestCopriProviderHttps.cs @@ -188,7 +188,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector cache.IsBikesAvailableExpired.Returns(true); cache.GetBikesAvailableAsync().Returns(Task.Run(() => JsonConvert.DeserializeObject(BIKESAVAILABLE))); - https.GetBikesAvailableAsync().Returns(x => { throw new WebConnectFailureException("Bang...", new Exception()); }); + https.GetBikesAvailableAsync().Returns(x => { throw new WebConnectFailureException("Bang...", new System.Exception()); }); var provider = new CopriProviderHttps( new Uri("http://1.2.3.4"), @@ -288,7 +288,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector cache.IsBikesOccupiedExpired.Returns(true); cache.GetBikesOccupiedAsync().Returns(Task.Run(() => JsonConvert.DeserializeObject(BIKESOCCUPIED))); - https.GetBikesOccupiedAsync().Returns(x => { throw new WebConnectFailureException("Bang...", new Exception()); }); + https.GetBikesOccupiedAsync().Returns(x => { throw new WebConnectFailureException("Bang...", new System.Exception()); }); var provider = new CopriProviderHttps( new Uri("http://1.2.3.4"), @@ -387,7 +387,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector cache.IsStationsExpired.Returns(true); cache.GetStationsAsync().Returns(Task.Run(() => JsonConvert.DeserializeObject(STATIONSALL))); - https.GetStationsAsync().Returns(x => { throw new WebConnectFailureException("Bang...", new Exception()); }); + https.GetStationsAsync().Returns(x => { throw new WebConnectFailureException("Bang...", new System.Exception()); }); var provider = new CopriProviderHttps( new Uri("http://1.2.3.4"), @@ -424,7 +424,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector try { // Do not add if an excption occurred - provider.AddToCache(new Result(typeof(CopriCallsHttps), JsonConvert.DeserializeObject(STATIONSALL), new GeneralData(), new Exception("Bang..."))); + provider.AddToCache(new Result(typeof(CopriCallsHttps), JsonConvert.DeserializeObject(STATIONSALL), new GeneralData(), new System.Exception("Bang..."))); stations = await provider.GetStations(true); Assert.AreEqual(0, stations.Response.stations.Count); @@ -464,7 +464,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector try { // Do not add if an excption occurred - provider.AddToCache(new Result(typeof(CopriCallsHttps), JsonConvert.DeserializeObject(BIKESAVAILABLE), new GeneralData(), new Exception("Bang..."))); + provider.AddToCache(new Result(typeof(CopriCallsHttps), JsonConvert.DeserializeObject(BIKESAVAILABLE), new GeneralData(), new System.Exception("Bang..."))); bikes = await provider.GetBikesAvailable(true); Assert.AreEqual(0, bikes.Response.bikes.Count); @@ -506,7 +506,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector try { // Do not add if an excption occurred - provider.AddToCache(new Result(typeof(CopriCallsHttps), JsonConvert.DeserializeObject(BIKESOCCUPIED), new GeneralData(), new Exception("Bang..."))); + provider.AddToCache(new Result(typeof(CopriCallsHttps), JsonConvert.DeserializeObject(BIKESOCCUPIED), new GeneralData(), new System.Exception("Bang..."))); bikes = await provider.GetBikesOccupied(true); Assert.AreEqual(0, bikes.Response.bikes_occupied.Count); diff --git a/TestTINKLib/Fixtures/ObjectTests/Logging/TestLoggingDirectoryManager.cs b/TestShareeLib/Model/Logging/TestLoggingDirectoryManager.cs similarity index 100% rename from TestTINKLib/Fixtures/ObjectTests/Logging/TestLoggingDirectoryManager.cs rename to TestShareeLib/Model/Logging/TestLoggingDirectoryManager.cs diff --git a/TestTINKLib/Fixtures/ObjectTests/TestFilterCollectionStore.cs b/TestShareeLib/Model/Settings/TestFilterCollectionStore.cs similarity index 100% rename from TestTINKLib/Fixtures/ObjectTests/TestFilterCollectionStore.cs rename to TestShareeLib/Model/Settings/TestFilterCollectionStore.cs diff --git a/TestTINKLib/Fixtures/ObjectTests/Settings/TestSettings.cs b/TestShareeLib/Model/Settings/TestSettings.cs similarity index 94% rename from TestTINKLib/Fixtures/ObjectTests/Settings/TestSettings.cs rename to TestShareeLib/Model/Settings/TestSettings.cs index a04969d..96ac009 100644 --- a/TestTINKLib/Fixtures/ObjectTests/Settings/TestSettings.cs +++ b/TestShareeLib/Model/Settings/TestSettings.cs @@ -1,4 +1,4 @@ -using System; +using System; using NUnit.Framework; using Serilog.Events; using TINK.Model.Services.CopriApi.ServerUris; @@ -6,7 +6,7 @@ using TINK.Settings; using TINK.ViewModel.Map; using TINK.ViewModel.Settings; -namespace TestTINKLib.Fixtures.ObjectTests.Settings +namespace TestTINKLib.Fixtures.ObjectTests.SettingsNS { [TestFixture] public class TestSettings diff --git a/TestTINKLib/Fixtures/ObjectTests/State/TestStateBookedInfo.cs b/TestShareeLib/Model/State/TestStateBookedInfo.cs similarity index 100% rename from TestTINKLib/Fixtures/ObjectTests/State/TestStateBookedInfo.cs rename to TestShareeLib/Model/State/TestStateBookedInfo.cs diff --git a/TestTINKLib/Fixtures/ObjectTests/State/TestStateDisposableInfo.cs b/TestShareeLib/Model/State/TestStateDisposableInfo.cs similarity index 100% rename from TestTINKLib/Fixtures/ObjectTests/State/TestStateDisposableInfo.cs rename to TestShareeLib/Model/State/TestStateDisposableInfo.cs diff --git a/TestTINKLib/Fixtures/ObjectTests/State/TestStateInfoSerializeJSON.cs b/TestShareeLib/Model/State/TestStateInfoSerializeJSON.cs similarity index 99% rename from TestTINKLib/Fixtures/ObjectTests/State/TestStateInfoSerializeJSON.cs rename to TestShareeLib/Model/State/TestStateInfoSerializeJSON.cs index 8be1bb7..030bb98 100644 --- a/TestTINKLib/Fixtures/ObjectTests/State/TestStateInfoSerializeJSON.cs +++ b/TestShareeLib/Model/State/TestStateInfoSerializeJSON.cs @@ -1,6 +1,7 @@ -using System; +using System; using Newtonsoft.Json; using NUnit.Framework; +using TestFramework; using TINK.Model.State; diff --git a/TestTINKLib/Fixtures/ObjectTests/State/TestStateRequestedInfoSerializeJSON.cs b/TestShareeLib/Model/State/TestStateRequestedInfoSerializeJSON.cs similarity index 98% rename from TestTINKLib/Fixtures/ObjectTests/State/TestStateRequestedInfoSerializeJSON.cs rename to TestShareeLib/Model/State/TestStateRequestedInfoSerializeJSON.cs index affe799..bd6a2b6 100644 --- a/TestTINKLib/Fixtures/ObjectTests/State/TestStateRequestedInfoSerializeJSON.cs +++ b/TestShareeLib/Model/State/TestStateRequestedInfoSerializeJSON.cs @@ -1,6 +1,7 @@ using System; using Newtonsoft.Json; using NUnit.Framework; +using TestFramework; using TINK.Model.State; diff --git a/TestTINKLib/Fixtures/ObjectTests/Station/TestNullStation.cs b/TestShareeLib/Model/Station/TestNullStation.cs similarity index 100% rename from TestTINKLib/Fixtures/ObjectTests/Station/TestNullStation.cs rename to TestShareeLib/Model/Station/TestNullStation.cs diff --git a/TestTINKLib/Fixtures/ObjectTests/Station/TestStation.cs b/TestShareeLib/Model/Station/TestStation.cs similarity index 100% rename from TestTINKLib/Fixtures/ObjectTests/Station/TestStation.cs rename to TestShareeLib/Model/Station/TestStation.cs diff --git a/TestTINKLib/Fixtures/ObjectTests/User/Account/TestAccount.cs b/TestShareeLib/Model/User/Account/TestAccount.cs similarity index 100% rename from TestTINKLib/Fixtures/ObjectTests/User/Account/TestAccount.cs rename to TestShareeLib/Model/User/Account/TestAccount.cs diff --git a/TestTINKLib/Fixtures/ObjectTests/User/Account/TestValidator.cs b/TestShareeLib/Model/User/Account/TestValidator.cs similarity index 100% rename from TestTINKLib/Fixtures/ObjectTests/User/Account/TestValidator.cs rename to TestShareeLib/Model/User/Account/TestValidator.cs diff --git a/TestTINKLib/Fixtures/ObjectTests/User/TestUser.cs b/TestShareeLib/Model/User/TestUser.cs similarity index 100% rename from TestTINKLib/Fixtures/ObjectTests/User/TestUser.cs rename to TestShareeLib/Model/User/TestUser.cs diff --git a/TestTINKLib/Fixtures/ObjectTests/Connector/Exception/TestAuthcookieNotDefinedException.cs b/TestShareeLib/Repository/Exception/TestAuthcookieNotDefinedException.cs similarity index 100% rename from TestTINKLib/Fixtures/ObjectTests/Connector/Exception/TestAuthcookieNotDefinedException.cs rename to TestShareeLib/Repository/Exception/TestAuthcookieNotDefinedException.cs diff --git a/TestTINKLib/Fixtures/ObjectTests/Connector/Response/TestBikesAvailableResponse.cs b/TestShareeLib/Repository/TestBikesAvailableResponse.cs similarity index 100% rename from TestTINKLib/Fixtures/ObjectTests/Connector/Response/TestBikesAvailableResponse.cs rename to TestShareeLib/Repository/TestBikesAvailableResponse.cs diff --git a/TestTINKLib/Fixtures/ObjectTests/Connector/Response/TestBikesOccupiedResponse.cs b/TestShareeLib/Repository/TestBikesOccupiedResponse.cs similarity index 100% rename from TestTINKLib/Fixtures/ObjectTests/Connector/Response/TestBikesOccupiedResponse.cs rename to TestShareeLib/Repository/TestBikesOccupiedResponse.cs diff --git a/TestTINKLib/Fixtures/ObjectTests/Connector/Response/TestBookingResponse.cs b/TestShareeLib/Repository/TestBookingResponse.cs similarity index 100% rename from TestTINKLib/Fixtures/ObjectTests/Connector/Response/TestBookingResponse.cs rename to TestShareeLib/Repository/TestBookingResponse.cs diff --git a/TestTINKLib/Fixtures/ObjectTests/Connector/TestCopriCallsMemory.cs.cs b/TestShareeLib/Repository/TestCopriCallsMemory.cs.cs similarity index 100% rename from TestTINKLib/Fixtures/ObjectTests/Connector/TestCopriCallsMemory.cs.cs rename to TestShareeLib/Repository/TestCopriCallsMemory.cs.cs diff --git a/TestTINKLib/Fixtures/ObjectTests/Connector/Response/TestResponseBase.cs b/TestShareeLib/Repository/TestResponseBase.cs similarity index 100% rename from TestTINKLib/Fixtures/ObjectTests/Connector/Response/TestResponseBase.cs rename to TestShareeLib/Repository/TestResponseBase.cs diff --git a/TestTINKLib/Fixtures/ObjectTests/Connector/Response/TestResponseHelper.cs b/TestShareeLib/Repository/TestResponseHelper.cs similarity index 100% rename from TestTINKLib/Fixtures/ObjectTests/Connector/Response/TestResponseHelper.cs rename to TestShareeLib/Repository/TestResponseHelper.cs diff --git a/TestTINKLib/Fixtures/ObjectTests/Connector/Response/TestStationsAllResponse.cs b/TestShareeLib/Repository/TestStationsAllResponse.cs similarity index 100% rename from TestTINKLib/Fixtures/ObjectTests/Connector/Response/TestStationsAllResponse.cs rename to TestShareeLib/Repository/TestStationsAllResponse.cs diff --git a/TestTINKLib/Fixtures/ObjectTests/Services/BluetoothLock/Crypto/TestCryptoHelper.cs b/TestShareeLib/Services/BluetoothLock/Crypto/TestCryptoHelper.cs similarity index 100% rename from TestTINKLib/Fixtures/ObjectTests/Services/BluetoothLock/Crypto/TestCryptoHelper.cs rename to TestShareeLib/Services/BluetoothLock/Crypto/TestCryptoHelper.cs diff --git a/TestTINKLib/Fixtures/ObjectTests/Services/BluetoothLock/Tdo/TestLockInfoAuthTdo.cs b/TestShareeLib/Services/BluetoothLock/Tdo/TestLockInfoAuthTdo.cs similarity index 100% rename from TestTINKLib/Fixtures/ObjectTests/Services/BluetoothLock/Tdo/TestLockInfoAuthTdo.cs rename to TestShareeLib/Services/BluetoothLock/Tdo/TestLockInfoAuthTdo.cs diff --git a/TestTINKLib/Fixtures/ObjectTests/Services/BluetoothLock/TestLockServiceSimulation.cs b/TestShareeLib/Services/BluetoothLock/TestLockServiceSimulation.cs similarity index 100% rename from TestTINKLib/Fixtures/ObjectTests/Services/BluetoothLock/TestLockServiceSimulation.cs rename to TestShareeLib/Services/BluetoothLock/TestLockServiceSimulation.cs diff --git a/TestTINKLib/Fixtures/ObjectTests/Services/TestLocksServicesContainerMutable.cs b/TestShareeLib/Services/BluetoothLock/TestLocksServicesContainerMutable.cs similarity index 100% rename from TestTINKLib/Fixtures/ObjectTests/Services/TestLocksServicesContainerMutable.cs rename to TestShareeLib/Services/BluetoothLock/TestLocksServicesContainerMutable.cs diff --git a/TestTINKLib/Fixtures/ObjectTests/Connector/TestCopriServerUriList.cs b/TestShareeLib/Services/CopriApi/ServerUris/TestCopriServerUriList.cs similarity index 100% rename from TestTINKLib/Fixtures/ObjectTests/Connector/TestCopriServerUriList.cs rename to TestShareeLib/Services/CopriApi/ServerUris/TestCopriServerUriList.cs diff --git a/TestTINKLib/Fixtures/ObjectTests/ViewModel/Bikes/Bike/BluetoothLock/TestRequestHandlerFactory.cs b/TestShareeLib/ViewModel/Bikes/Bike/BluetoothLock/TestRequestHandlerFactory.cs similarity index 89% rename from TestTINKLib/Fixtures/ObjectTests/ViewModel/Bikes/Bike/BluetoothLock/TestRequestHandlerFactory.cs rename to TestShareeLib/ViewModel/Bikes/Bike/BluetoothLock/TestRequestHandlerFactory.cs index 6e458bc..e4e9ede 100644 --- a/TestTINKLib/Fixtures/ObjectTests/ViewModel/Bikes/Bike/BluetoothLock/TestRequestHandlerFactory.cs +++ b/TestShareeLib/ViewModel/Bikes/Bike/BluetoothLock/TestRequestHandlerFactory.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using NUnit.Framework; -using Rhino.Mocks; using TestFramework.Model.Services.Geolocation; using TestFramework.Services.BluetoothLock; using TINK.Model.Bikes.BikeInfoNS.BikeNS; @@ -42,8 +41,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike.BluetoothLock null, // viewUpdateManager NSubstitute.Substitute.For(), null /* viewService */ , - MockRepository.GenerateStub(), - MockRepository.GenerateStub()).GetType()); + NSubstitute.Substitute.For(), + NSubstitute.Substitute.For()).GetType()); // Verify handler for requested bike with state unknown. bike = new BikeInfoMutable( @@ -60,8 +59,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike.BluetoothLock null, // viewUpdateManager NSubstitute.Substitute.For(), null /* viewService */, - MockRepository.GenerateStub(), - MockRepository.GenerateStub()).GetType()); + NSubstitute.Substitute.For(), + NSubstitute.Substitute.For()).GetType()); // Verify handler for requested bike with state closed. bike = new BikeInfoMutable( @@ -79,8 +78,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike.BluetoothLock null, // viewUpdateManager NSubstitute.Substitute.For(), null /* viewService */, - MockRepository.GenerateStub(), - MockRepository.GenerateStub()).GetType()); + NSubstitute.Substitute.For(), + NSubstitute.Substitute.For()).GetType()); // Verify handler for requested bike with state open. bike = new BikeInfoMutable( @@ -98,8 +97,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike.BluetoothLock null, // viewUpdateManager NSubstitute.Substitute.For(), null /* viewService */, - MockRepository.GenerateStub(), - MockRepository.GenerateStub()).GetType()); + NSubstitute.Substitute.For(), + NSubstitute.Substitute.For()).GetType()); // Verify handler for booked bike with state closed. bike = new BikeInfoMutable( @@ -117,8 +116,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike.BluetoothLock null, // viewUpdateManager NSubstitute.Substitute.For(), null /* viewService */, - MockRepository.GenerateStub(), - MockRepository.GenerateStub()).GetType()); + NSubstitute.Substitute.For(), + NSubstitute.Substitute.For()).GetType()); // Verify handler for booked bike with state open. bike = new BikeInfoMutable( @@ -136,8 +135,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike.BluetoothLock null, // viewUpdateManager NSubstitute.Substitute.For(), null /* viewService */, - MockRepository.GenerateStub(), - MockRepository.GenerateStub()).GetType()); + NSubstitute.Substitute.For(), + NSubstitute.Substitute.For()).GetType()); // Verify handler for booked bike with state unknown. bike = new BikeInfoMutable( @@ -155,8 +154,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike.BluetoothLock null, // viewUpdateManager NSubstitute.Substitute.For(), null /* viewService */, - MockRepository.GenerateStub(), - MockRepository.GenerateStub()).GetType()); + NSubstitute.Substitute.For(), + NSubstitute.Substitute.For()).GetType()); } } } diff --git a/TestTINKLib/Fixtures/ObjectTests/ViewModel/TestBikeViewModelFactory.cs b/TestShareeLib/ViewModel/Bikes/Bike/TestBikeViewModelFactory.cs similarity index 85% rename from TestTINKLib/Fixtures/ObjectTests/ViewModel/TestBikeViewModelFactory.cs rename to TestShareeLib/ViewModel/Bikes/Bike/TestBikeViewModelFactory.cs index dc0d89b..821ae54 100644 --- a/TestTINKLib/Fixtures/ObjectTests/ViewModel/TestBikeViewModelFactory.cs +++ b/TestShareeLib/ViewModel/Bikes/Bike/TestBikeViewModelFactory.cs @@ -1,6 +1,5 @@ using System; using NUnit.Framework; -using Rhino.Mocks; using TestFramework.Model.Services.Geolocation; using TestFramework.Services.BluetoothLock; using TINK.Model.Bikes.BikeInfoNS.BC; @@ -32,9 +31,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel NSubstitute.Substitute.For(), null, // viewService new TINK.Model.Bikes.BikeInfoNS.BluetoothLock.BikeInfoMutable(new TINK.Model.Bikes.BikeInfoNS.BluetoothLock.BikeInfo(new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("42", LockModel.ILockIt), new Drive(), DataSource.Copri, 5200544, new Guid("00000000-0000-0000-0000-000000000001"), "42"), "My Station Name"), - MockRepository.GenerateStub(), // user - MockRepository.GenerateStub(), - MockRepository.GenerateStub(), + NSubstitute.Substitute.For(), // user + NSubstitute.Substitute.For(), + NSubstitute.Substitute.For(), url => { }).GetType()); // stateInfoProvider } @@ -53,9 +52,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel NSubstitute.Substitute.For(), null, // viewService new TINK.Model.Bikes.BikeInfoNS.CopriLock.BikeInfoMutable(new TINK.Model.Bikes.BikeInfoNS.CopriLock.BikeInfo(new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("42", LockModel.ILockIt), new Drive(), TINK.Model.Bikes.BikeInfoNS.BC.DataSource.Copri, "17", new TINK.Model.Bikes.BikeInfoNS.CopriLock.LockInfo.Builder { State = TINK.Model.Bikes.BikeInfoNS.CopriLock.LockingState.Closed }.Build()), "My Station Name"), - MockRepository.GenerateStub(), // user - MockRepository.GenerateStub(), - MockRepository.GenerateStub(), + NSubstitute.Substitute.For(), // user + NSubstitute.Substitute.For(), + NSubstitute.Substitute.For(), url => { }).GetType()); // stateInfoProvider } @@ -73,9 +72,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel NSubstitute.Substitute.For(), null, // viewService new TINK.Model.Bikes.BikeInfoNS.BC.BikeInfoMutable(new TINK.Model.Bikes.BikeInfoNS.BluetoothLock.BikeInfo(new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("42", TINK.Model.Bikes.BikeInfoNS.BikeNS.LockModel.ILockIt), new Drive(), DataSource.Copri, 5200544, new Guid("00000000-0000-0000-0000-000000000001"), "42"), "My Station Name"), - MockRepository.GenerateStub(), // user - MockRepository.GenerateStub(), - MockRepository.GenerateStub(), + NSubstitute.Substitute.For(), // user + NSubstitute.Substitute.For(), + NSubstitute.Substitute.For(), url => { }), Is.Null); } diff --git a/TestShareeLib/ViewModel/BikesAtStation/TestBikesAtStationPageViewModel.cs b/TestShareeLib/ViewModel/BikesAtStation/TestBikesAtStationPageViewModel.cs index 802b40e..19c1caa 100644 --- a/TestShareeLib/ViewModel/BikesAtStation/TestBikesAtStationPageViewModel.cs +++ b/TestShareeLib/ViewModel/BikesAtStation/TestBikesAtStationPageViewModel.cs @@ -1109,7 +1109,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel await bikesAtStation.OnAppearingOrRefresh(); - //Assert.AreEqual("Offline.", bikesAtStation.StatusInfoText); + Assert.AreEqual("Offline.", bikesAtStation.StatusInfoText); // Verify list of bikes Assert.AreEqual(2, bikesAtStation.Count); // Count of bikes was 3. There is no more bike with id 26. diff --git a/TestTINKLib/Fixtures/ObjectTests/ViewModel/Info/TestInfoViewModel.cs b/TestShareeLib/ViewModel/Info/TestInfoViewModel.cs similarity index 100% rename from TestTINKLib/Fixtures/ObjectTests/ViewModel/Info/TestInfoViewModel.cs rename to TestShareeLib/ViewModel/Info/TestInfoViewModel.cs diff --git a/TestTINKLib/Fixtures/ObjectTests/TestFilterCollection.cs b/TestShareeLib/ViewModel/Map/TestFilterCollection.cs similarity index 100% rename from TestTINKLib/Fixtures/ObjectTests/TestFilterCollection.cs rename to TestShareeLib/ViewModel/Map/TestFilterCollection.cs diff --git a/TestTINKLib/Fixtures/ObjectTests/Map/TestMapPageFilter.cs b/TestShareeLib/ViewModel/Map/TestMapPageFilter.cs similarity index 100% rename from TestTINKLib/Fixtures/ObjectTests/Map/TestMapPageFilter.cs rename to TestShareeLib/ViewModel/Map/TestMapPageFilter.cs diff --git a/TestTINKLib/Fixtures/ObjectTests/ViewModel/Map/TestMapPageViewModel.cs b/TestShareeLib/ViewModel/Map/TestMapPageViewModel.cs similarity index 100% rename from TestTINKLib/Fixtures/ObjectTests/ViewModel/Map/TestMapPageViewModel.cs rename to TestShareeLib/ViewModel/Map/TestMapPageViewModel.cs diff --git a/TestTINKLib/Fixtures/ObjectTests/ViewModel/Settings/TestFilterCollectionMutable.cs b/TestShareeLib/ViewModel/Settings/TestFilterCollectionMutable.cs similarity index 100% rename from TestTINKLib/Fixtures/ObjectTests/ViewModel/Settings/TestFilterCollectionMutable.cs rename to TestShareeLib/ViewModel/Settings/TestFilterCollectionMutable.cs diff --git a/TestTINKLib/Fixtures/ObjectTests/Settings/TestGroupFilterSettings.cs b/TestShareeLib/ViewModel/Settings/TestGroupFilterSettings.cs similarity index 88% rename from TestTINKLib/Fixtures/ObjectTests/Settings/TestGroupFilterSettings.cs rename to TestShareeLib/ViewModel/Settings/TestGroupFilterSettings.cs index bb61f2d..cea08db 100644 --- a/TestTINKLib/Fixtures/ObjectTests/Settings/TestGroupFilterSettings.cs +++ b/TestShareeLib/ViewModel/Settings/TestGroupFilterSettings.cs @@ -1,11 +1,11 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using NUnit.Framework; using TINK.Model; using TINK.Model.Connector; using TINK.ViewModel.Settings; -namespace TestTINKLib.Fixtures.ObjectTests.Settings +namespace TestTINKLib.Fixtures.ObjectTests.SettingsNS { [TestFixture] public class TestGroupFilterSettings @@ -21,4 +21,4 @@ namespace TestTINKLib.Fixtures.ObjectTests.Settings Assert.AreEqual($"HOM_{FilterHelper.CARGOBIKE}", l_oResult.ToList()[0]); } } -} \ No newline at end of file +} diff --git a/TestTINKLib/Fixtures/ObjectTests/Settings/TestPollingParameters.cs b/TestShareeLib/ViewModel/Settings/TestPollingParameters.cs similarity index 95% rename from TestTINKLib/Fixtures/ObjectTests/Settings/TestPollingParameters.cs rename to TestShareeLib/ViewModel/Settings/TestPollingParameters.cs index 3bc6266..c7c18ee 100644 --- a/TestTINKLib/Fixtures/ObjectTests/Settings/TestPollingParameters.cs +++ b/TestShareeLib/ViewModel/Settings/TestPollingParameters.cs @@ -1,8 +1,8 @@ -using System; +using System; using NUnit.Framework; using TINK.Settings; -namespace TestTINKLib.Fixtures.ObjectTests.Settings +namespace TestTINKLib.Fixtures.ObjectTests.SettingsNS { [TestFixture] public class TestPollingParameters diff --git a/TestTINKLib/Fixtures/ObjectTests/ViewModel/TestBikeAtStationInUseStateInfoProvider.cs b/TestShareeLib/ViewModel/TestBikeAtStationInUseStateInfoProvider.cs similarity index 100% rename from TestTINKLib/Fixtures/ObjectTests/ViewModel/TestBikeAtStationInUseStateInfoProvider.cs rename to TestShareeLib/ViewModel/TestBikeAtStationInUseStateInfoProvider.cs diff --git a/TestTINKLib/Fixtures/ObjectTests/ViewModel/TestMyBikeInUseStateInfoProvider.cs b/TestShareeLib/ViewModel/TestMyBikeInUseStateInfoProvider.cs similarity index 100% rename from TestTINKLib/Fixtures/ObjectTests/ViewModel/TestMyBikeInUseStateInfoProvider.cs rename to TestShareeLib/ViewModel/TestMyBikeInUseStateInfoProvider.cs diff --git a/TestShareeLib/ViewModel/TestViewModelHelper.cs b/TestShareeLib/ViewModel/TestViewModelHelper.cs index 7271793..9eba0b2 100644 --- a/TestShareeLib/ViewModel/TestViewModelHelper.cs +++ b/TestShareeLib/ViewModel/TestViewModelHelper.cs @@ -1,7 +1,8 @@ -using System; +using System; using NSubstitute; using NUnit.Framework; using TINK.Model.Bikes.BikeInfoNS.BC; +using TINK.Model.Bikes.BikeInfoNS.BikeNS; using TINK.ViewModel; namespace TestShareeLib.ViewModel @@ -124,5 +125,76 @@ namespace TestShareeLib.ViewModel new AggregateException(new Exception("Oh yes"), new Exception("Oh no")).GetErrorMessage(), Is.EqualTo("One or more errors occurred.\r\nOh yes\r\nOh no")); } + + [Test] + public void TestGetDisplayName_DefinedTypes() + { + var bike = Substitute.For(); + bike.WheelType.Returns(WheelType.Two); + bike.TypeOfBike.Returns(TypeOfBike.City); + bike.Description.Returns("MeinStadtrad"); + bike.Id.Returns("22"); + Assert.AreEqual( + "MeinStadtrad", + bike.GetDisplayName()); + + Assert.AreEqual( + "22", + bike.GetDisplayId()); + + bike = Substitute.For(); + bike.WheelType.Returns(WheelType.Two); + bike.TypeOfBike.Returns(TypeOfBike.City); + bike.Id.Returns("22"); + bike.IsDemo.Returns(true); + bike.Description.Returns("MeinStadtrad"); + Assert.AreEqual( + "MeinStadtrad", + bike.GetDisplayName()); + Assert.AreEqual( + "22", + bike.GetDisplayId()); + + bike = Substitute.For(); + bike.WheelType.Returns(WheelType.Trike); + bike.TypeOfBike.Returns(TypeOfBike.Cargo); + bike.Description.Returns("MeinCargoDreiradl"); + bike.Id.Returns("22"); + Assert.AreEqual( + "MeinCargoDreiradl", + bike.GetDisplayName()); + Assert.AreEqual( + "22", + bike.GetDisplayId()); + + bike = Substitute.For(); + bike.WheelType.Returns(WheelType.Two); + bike.TypeOfBike.Returns(TypeOfBike.Cargo); + bike.Description.Returns("MeinCargoALololong"); + bike.Id.Returns("22"); + Assert.AreEqual( + "MeinCargoALololong", + bike.GetDisplayName()); + Assert.AreEqual( + "22", + bike.GetDisplayId()); + } + + [Test] + public void TestGetDisplayName_UndefinedTypes() + { + var bike = Substitute.For(); + bike.WheelType.Returns(WheelType.Mono); + bike.TypeOfBike.Returns(TypeOfBike.Cargo); + bike.Description.Returns("SuperCargo"); + bike.Id.Returns("22"); + Assert.AreEqual( + "SuperCargo", + bike.GetDisplayName()); + + Assert.AreEqual( + "22", + bike.GetDisplayId()); + } } } diff --git a/TestTINKLib/Fixtures/ObjectTests/Bike/BluetoothLock/TestBikeInfo.cs b/TestTINKLib/Fixtures/ObjectTests/Bike/BluetoothLock/TestBikeInfo.cs deleted file mode 100644 index 4f40e11..0000000 --- a/TestTINKLib/Fixtures/ObjectTests/Bike/BluetoothLock/TestBikeInfo.cs +++ /dev/null @@ -1,50 +0,0 @@ -using NUnit.Framework; -using System; -using TINK.Model.Bike.BluetoothLock; -using TINK.Model.State; - -namespace TestTINKLib.Fixtures.ObjectTests.Bike.BluetoothLock -{ - [TestFixture] - public class TestBikeInfo - { - /// - /// Moved to TestShareeLib (.Net Core) - /// - [Test] - public void TestCtorCopyNull() - { - Assert.Throws( - () => new BikeInfo(null, null), - "Verify that no unspecific reference not set to... exception is thrown"); - - Assert.Throws( - () => new BikeInfo(new TINK.Model.Bike.BC.BikeInfo(12,1), null), - "Verify that no unspecific reference not set to... exception is thrown"); - } - - [Test] - public void TestCtorAvailable() - { - Assert.AreEqual (12,new BikeInfo(12, 13).Id); - Assert.AreEqual(13, new BikeInfo(12, 13).CurrentStation); - Assert.AreEqual(InUseStateEnum.Disposable, new BikeInfo(12, 13).State.Value); - } - - [Test] - public void TestCtorRequested() - { - Assert.AreEqual(12, new BikeInfo(12, 112, new Guid(), null, null, null, new DateTime(2020, 1, 1), "a@b", 13, dateTimeProvider: () => new DateTime(2019, 1, 1)).Id); - Assert.AreEqual(112, new BikeInfo(12, 112, new Guid(), null, null, null, new DateTime(2020,1,1), "a@b", 13, dateTimeProvider: () => new DateTime(2019, 1, 1)).LockInfo.Id); - Assert.AreEqual(InUseStateEnum.Reserved, new BikeInfo(12, 112, new Guid(), null, null, null, new DateTime(2020, 1, 1), "a@b", 13, dateTimeProvider: () => new DateTime(2019, 1, 1)).State.Value); - } - - [Test] - public void TestCtorBooked() - { - Assert.AreEqual(12, new BikeInfo(12, 112, new Guid(), null, null, null, new DateTime(2020, 1, 1), "a@b", 13).Id); - Assert.AreEqual(112, new BikeInfo(12, 112, new Guid(), null, null, null, new DateTime(2020, 1, 1), "a@b", 13).LockInfo.Id); - Assert.AreEqual(InUseStateEnum.Booked, new BikeInfo(12, 112, new Guid(), null, null, null, new DateTime(2020, 1, 1), "a@b", 13).State.Value); - } - } -} diff --git a/TestTINKLib/Fixtures/ObjectTests/Bike/BluetoothLock/TestLockInfo.cs b/TestTINKLib/Fixtures/ObjectTests/Bike/BluetoothLock/TestLockInfo.cs deleted file mode 100644 index 5e83381..0000000 --- a/TestTINKLib/Fixtures/ObjectTests/Bike/BluetoothLock/TestLockInfo.cs +++ /dev/null @@ -1,155 +0,0 @@ -using NUnit.Framework; -using System; -using TINK.Model.Bike.BluetoothLock; -namespace TestTINKLib.Fixtures.ObjectTests.Bike.BluetoothLock -{ - [TestFixture] - public class TestLockInfo - { - /// - /// Moved to TestShareeLib (.Net Core) - /// - [Test] - public void TestCtor() - { - Assert.AreEqual( - LockingState.Unknown, - new LockInfo.Builder { Id = 123 }.Build().State); - - Assert.AreEqual( - 123, - new LockInfo.Builder { Id = 123 }.Build().Id); - } - - [Test] - public void TestEquals() - { - Assert.IsTrue(new LockInfo.Builder { - Id = 2, - Guid = new Guid("0000f00d-1212-efde-1523-785fef13d123"), - Seed = new byte[] { 1, 2 }, - UserKey = new byte[] { 7, 2 }, - AdminKey = new byte[] { 2, 1 }, - State = LockingState.Closed}.Build() == new LockInfo.Builder { - Id = 2, - Guid = new Guid("0000f00d-1212-efde-1523-785fef13d123"), - Seed = new byte[] { 1, 2 }, - UserKey = new byte[] { 7, 2 }, - AdminKey = new byte[] { 2, 1 }, - State = LockingState.Closed - }.Build()); - } - - [Test] - public void TestEqualsFalse() - { - Assert.IsFalse(new LockInfo.Builder - { - Id = 2, - Guid = new Guid("0000f00d-1212-efde-1523-785fef13d123"), - Seed = new byte[] { 1, 2 }, - UserKey = new byte[] { 7, 2 }, - AdminKey = new byte[] { 2, 1 }, - State = LockingState.Closed - }.Build() == new LockInfo.Builder - { - Id = 3, - Guid = new Guid("0000f00d-1212-efde-1523-785fef13d123"), - Seed = new byte[] { 1, 2 }, - UserKey = new byte[] { 7, 2 }, - AdminKey = new byte[] { 2, 1 }, - State = LockingState.Closed - }.Build()); - - Assert.IsFalse(new LockInfo.Builder - { - Id = 2, - Guid = new Guid("0000f00d-1212-efde-1523-785fef13d123"), - Seed = new byte[] { 1, 2 }, - UserKey = new byte[] { 7, 2 }, - AdminKey = new byte[] { 2, 1 }, - State = LockingState.Closed - }.Build() == new LockInfo.Builder - { - Id = 2, - Guid = new Guid("1000f00d-1212-efde-1523-785fef13d123"), - Seed = new byte[] { 1, 2 }, - UserKey = new byte[] { 7, 2 }, - AdminKey = new byte[] { 2, 1 }, - State = LockingState.Closed - }.Build()); - - Assert.IsFalse(new LockInfo.Builder - { - Id = 2, - Guid = new Guid("0000f00d-1212-efde-1523-785fef13d123"), - Seed = new byte[] { 1, 2 }, - UserKey = new byte[] { 7, 2 }, - AdminKey = new byte[] { 2, 1 }, - State = LockingState.Closed - }.Build() == new LockInfo.Builder - { - Id = 2, - Guid = new Guid("0000f00d-1212-efde-1523-785fef13d123"), - Seed = new byte[] { 5, 2 }, - UserKey = new byte[] { 7, 2 }, - AdminKey = new byte[] { 2, 1 }, - State = LockingState.Closed - }.Build()); - - Assert.IsFalse(new LockInfo.Builder - { - Id = 2, - Guid = new Guid("0000f00d-1212-efde-1523-785fef13d123"), - Seed = new byte[] { 1, 2 }, - UserKey = new byte[] { 7, 2 }, - AdminKey = new byte[] { 2, 1 }, - State = LockingState.Closed - }.Build() == new LockInfo.Builder - { - Id = 2, - Guid = new Guid("0000f00d-1212-efde-1523-785fef13d123"), - Seed = new byte[] { 1, 2 }, - UserKey = new byte[] { 9, 2 }, - AdminKey = new byte[] { 2, 1 }, - State = LockingState.Closed - }.Build()); - - Assert.IsFalse(new LockInfo.Builder - { - Id = 2, - Guid = new Guid("0000f00d-1212-efde-1523-785fef13d123"), - Seed = new byte[] { 1, 2 }, - UserKey = new byte[] { 7, 2 }, - AdminKey = new byte[] { 2, 1 }, - State = LockingState.Closed - }.Build() == new LockInfo.Builder - { - Id = 2, - Guid = new Guid("0000f00d-1212-efde-1523-785fef13d123"), - Seed = new byte[] { 1, 2 }, - UserKey = new byte[] { 7, 2 }, - AdminKey = new byte[] { 11, 1 }, - State = LockingState.Closed - }.Build()); - - Assert.IsFalse(new LockInfo.Builder - { - Id = 2, - Guid = new Guid("0000f00d-1212-efde-1523-785fef13d123"), - Seed = new byte[] { 1, 2 }, - UserKey = new byte[] { 7, 2 }, - AdminKey = new byte[] { 2, 1 }, - State = LockingState.Closed - }.Build() == new LockInfo.Builder - { - Id = 2, - Guid = new Guid("0000f00d-1212-efde-1523-785fef13d123"), - Seed = new byte[] { 1, 2 }, - UserKey = new byte[] { 7, 2 }, - AdminKey = new byte[] { 2, 1 }, - State = LockingState.Open - }.Build()); - } - } -} diff --git a/TestTINKLib/Fixtures/ObjectTests/Bike/BluetoothLock/TestLockInfoHelper.cs b/TestTINKLib/Fixtures/ObjectTests/Bike/BluetoothLock/TestLockInfoHelper.cs deleted file mode 100644 index 8956633..0000000 --- a/TestTINKLib/Fixtures/ObjectTests/Bike/BluetoothLock/TestLockInfoHelper.cs +++ /dev/null @@ -1,56 +0,0 @@ -using NUnit.Framework; -using System; -using System.Collections.Generic; -using System.Linq; -using TINK.Model.Bike.BluetoothLock; -using TINK.Services.BluetoothLock.Tdo; - -namespace TestTINKLib.Fixtures.ObjectTests.Bike.BluetoothLock -{ - /// - /// Moved to TestShareeLib (.Net Core) - /// - [TestFixture] - public class TestLockInfoHelper - { - [Test] - public void TestUpdateById_State() - { - var locksInfo = new List { - new LockInfo.Builder { Id = 12, Seed = new byte[] { 3, 5 }, UserKey = new byte[] {2, 1 }, State = LockingState.Unknown }.Build(), - new LockInfo.Builder { Id = 14, Seed = new byte[] { 3, 1 }, UserKey = new byte[] {2, 7 }, State = LockingState.Open }.Build(), - new LockInfo.Builder { Id = 3, Seed = new byte[] { 1, 5 }, UserKey = new byte[] {2, 9 }, State = LockingState.Closed }.Build(), - }; - - var locksInfoTdo = new List { - new LockInfoTdo.Builder { Id =14, State = LockitLockingState.Closed}.Build() - }; - - var resultList = locksInfo.UpdateById(locksInfoTdo); - - var result = resultList.FirstOrDefault(x => x.Id == 14); - Assert.NotNull(result, "Target element was removed."); - Assert.AreEqual(LockingState.Closed, result.State); - } - - [Test] - public void TestUpdateById_Guid() - { - var locksInfo = new List { - new LockInfo.Builder { Id = 12, Seed = new byte[] { 3, 5 }, UserKey = new byte[] {2, 1 }, State = LockingState.Unknown }.Build(), - new LockInfo.Builder { Id = 14, Seed = new byte[] { 3, 1 }, UserKey = new byte[] {2, 7 }, State = LockingState.Open }.Build(), - new LockInfo.Builder { Id = 3, Seed = new byte[] { 1, 5 }, UserKey = new byte[] {2, 9 }, State = LockingState.Closed }.Build(), - }; - - var locksInfoTdo = new List { - new LockInfoTdo.Builder { Id =14, Guid = new System.Guid("00000000-0000-0000-0000-e57e6b9aee16"), State = LockitLockingState.Open}.Build() - }; - - var resultList = locksInfo.UpdateById(locksInfoTdo); - - var result = resultList.FirstOrDefault(x => x.Id == 14); - Assert.NotNull(result, "Target element was removed."); - Assert.AreEqual(new Guid("00000000-0000-0000-0000-e57e6b9aee16"), result.Guid); - } - } -} diff --git a/TestTINKLib/Fixtures/ObjectTests/Bike/BluetoothLock/TestLockInfoMutable.cs b/TestTINKLib/Fixtures/ObjectTests/Bike/BluetoothLock/TestLockInfoMutable.cs deleted file mode 100644 index 2b15d30..0000000 --- a/TestTINKLib/Fixtures/ObjectTests/Bike/BluetoothLock/TestLockInfoMutable.cs +++ /dev/null @@ -1,39 +0,0 @@ -using NUnit.Framework; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using TINK.Model.Bike.BluetoothLock; - -namespace TestTINKLib.Fixtures.ObjectTests.Bike.BluetoothLock -{ - /// - /// Moved to TestShareeLib (.Net Core) - /// - [TestFixture] - public class TestLockInfoMutable - { - [Test] - public void TestCtor() - { - var lockInfo = new LockInfoMutable(1, new Guid(), new byte[] { 1, 2, 3 }, new byte[] { 1, 23 }, new byte[] { 1, 12 }, LockingState.Closed); - - Assert.AreEqual(1, lockInfo.Id); - Assert.AreEqual(new Guid(), lockInfo.Guid); - Assert.IsTrue((new byte[] { 1, 2, 3 }).SequenceEqual(lockInfo.UserKey)); - Assert.IsTrue((new byte[] { 1, 23 }).SequenceEqual(lockInfo.AdminKey)); - Assert.IsTrue((new byte[] { 1, 12 }).SequenceEqual(lockInfo.Seed)); - Assert.AreEqual(LockingState.Closed, lockInfo.State); - } - - [Test] - public void TestSetGuid() - { - var lockInfo = new LockInfoMutable(1, new Guid(), new byte[] { 1, 2, 3 }, new byte[] { 1, 23 }, new byte[] { 1, 12 }, LockingState.Closed); - - lockInfo.Guid = new Guid("00000000-0000-0000-0000-e57e6b9aee16"); - Assert.AreEqual(new Guid("00000000-0000-0000-0000-e57e6b9aee16"), lockInfo.Guid); - } - } -} diff --git a/TestTINKLib/Fixtures/ObjectTests/Bike/TestBike.cs b/TestTINKLib/Fixtures/ObjectTests/Bike/TestBike.cs deleted file mode 100644 index 715e962..0000000 --- a/TestTINKLib/Fixtures/ObjectTests/Bike/TestBike.cs +++ /dev/null @@ -1,49 +0,0 @@ -using NUnit.Framework; - -namespace TestTINKLib.Fixtures.ObjectTests.Bike -{ - using TINK.Model.Bike; - - /// - /// Moved to TestShareeLib (.Net Core) - /// - [TestFixture] - public class TestBike - { - [Test] - public void TestConstruct() - { - var l_oBike = new Bike(43); - Assert.AreEqual(43, l_oBike.Id); - Assert.AreEqual(null, l_oBike.TypeOfBike); - Assert.AreEqual(null, l_oBike.WheelType); - - l_oBike = new Bike(43, WheelType.Mono, TypeOfBike.Cargo); - - Assert.AreEqual(43, l_oBike.Id); - Assert.AreEqual(TypeOfBike.Cargo, l_oBike.TypeOfBike); - Assert.AreEqual(WheelType.Mono, l_oBike.WheelType); - } - - [Test] - public void TestCompare() - { - var l_oBike1 = new Bike(43); - Assert.AreEqual(43, l_oBike1.Id); - Assert.AreEqual(null, l_oBike1.TypeOfBike); - Assert.AreEqual(null, l_oBike1.WheelType); - - var l_oBike2 = new Bike(42, WheelType.Two, TypeOfBike.Allround); - Assert.IsFalse(l_oBike1 == l_oBike2); - - l_oBike2 = new Bike(43, WheelType.Mono, TypeOfBike.Allround); - Assert.IsFalse(l_oBike1 == l_oBike2); - - l_oBike2 = new Bike(43, WheelType.Two, TypeOfBike.Cargo); - Assert.IsFalse(l_oBike1 == l_oBike2); - - l_oBike2 = new Bike(43, null, null); - Assert.IsTrue(l_oBike1 == l_oBike2); - } - } -} diff --git a/TestTINKLib/Fixtures/ObjectTests/Bike/TestBikeCollection.cs b/TestTINKLib/Fixtures/ObjectTests/Bike/TestBikeCollection.cs deleted file mode 100644 index 95a8f78..0000000 --- a/TestTINKLib/Fixtures/ObjectTests/Bike/TestBikeCollection.cs +++ /dev/null @@ -1,25 +0,0 @@ -using NUnit.Framework; -using System; -using TINK.Model.Bike; - - -namespace TestTINKLib -{ - - /// - /// Moved to TestShareeLib (.Net Core) - /// - [TestFixture] - public class TestBikeCollection - { - /// Tests the member. - [Test] - public void TestConstruct() - { - var l_oColl = new BikeCollection(); - - Assert.AreEqual(0, l_oColl.Count); - Assert.IsNull(l_oColl.GetById(1)); - } - } -} diff --git a/TestTINKLib/Fixtures/ObjectTests/Bike/TestBikeCollectionFilter.cs b/TestTINKLib/Fixtures/ObjectTests/Bike/TestBikeCollectionFilter.cs deleted file mode 100644 index f8d90f7..0000000 --- a/TestTINKLib/Fixtures/ObjectTests/Bike/TestBikeCollectionFilter.cs +++ /dev/null @@ -1,78 +0,0 @@ -using NUnit.Framework; -using System.Collections.Generic; -using TINK.Model; -using TINK.Model.Bike; - -namespace TestTINKLib.Fixtures.ObjectTests.Bike -{ - /// - /// Moved to TestShareeLib (.Net Core) - /// - [TestFixture] - public class TestBikeCollectionFilter - { - [Test] - public void TestGetAtStation() - { - var coll = new BikeCollection( - new Dictionary - { - {3, new TINK.Model.Bike.BC.BikeInfo(7, 3 /* Stadion id */) }, - {7, new TINK.Model.Bike.BC.BikeInfo(8, 12 /* Stadion id */) }, - {12, new TINK.Model.Bike.BC.BikeInfo(33, 12 /* Stadion id */) } - }); - - Assert.AreEqual( - 0, - BikeCollectionFilter.GetAtStation(null, 12).Count); - - Assert.AreEqual( - 0, - coll.GetAtStation(null).Count); - - Assert.AreEqual( - 0, - coll.GetAtStation(22).Count); - - Assert.AreEqual( - 1, - coll.GetAtStation(3).Count); - - Assert.AreEqual( - 2, - coll.GetAtStation(12).Count); - } - - [Test] - public void TestGetLockIt() - { - var coll = new BikeCollection( - new Dictionary - { - {7, new TINK.Model.Bike.BC.BikeInfo(8, 12 /* Stadion id */) }, - {12, new TINK.Model.Bike.BC.BikeInfo(33, 12 /* Stadion id */) } - }); - - - Assert.AreEqual( - 0, - coll.GetLockIt().Count); - - coll = new BikeCollection( - new Dictionary - { - {7, new TINK.Model.Bike.BC.BikeInfo(8, 12 /* Stadion id */) }, - {11, new TINK.Model.Bike.BluetoothLock.BikeInfo(33, 12 /* Stadion id */) }, - {12, new TINK.Model.Bike.BC.BikeInfo(33, 12 /* Stadion id */) } - }); - - Assert.AreEqual( - 0, - BikeCollectionFilter.GetLockIt(null).Count); - - Assert.AreEqual( - 1, - coll.GetLockIt().Count); - } - } -} diff --git a/TestTINKLib/Fixtures/ObjectTests/Bike/TestBikeCollectionMutable.cs b/TestTINKLib/Fixtures/ObjectTests/Bike/TestBikeCollectionMutable.cs deleted file mode 100644 index a67b6ea..0000000 --- a/TestTINKLib/Fixtures/ObjectTests/Bike/TestBikeCollectionMutable.cs +++ /dev/null @@ -1,93 +0,0 @@ -using NUnit.Framework; -using System; -using System.Collections.Generic; -using TINK.Model.Bike; -using TINK.Model.State; - -using BikeInfo = TINK.Model.Bike.BC.BikeInfo; -using BikeInfoMutable = TINK.Model.Bike.BC.BikeInfoMutable; - -namespace TestTINKLib -{ - - /// - /// Moved to TestShareeLib (.Net Core) - /// - [TestFixture] - public class TestBikeCollectionMutable - { - /// Tests the member. - [Test] - public void TestAdd() - { - var l_oColl = new BikeCollectionMutable(); - - l_oColl.Add(new BikeInfoMutable(57, false, new List { "TINK" }, WheelType.Two, TypeOfBike.Allround)); - - Assert.Throws(() => l_oColl.Add(new BikeInfoMutable(57, false, new List { "TINK" }, WheelType.Trike, TypeOfBike.Cargo))); - } - - [Test] - public void TestUpdate_Null() - { - var l_oBikeRequested = new BikeInfoMutable(20, false, new List { "TINK" }, WheelType.Trike, TypeOfBike.Allround); - l_oBikeRequested.State.Load(new StateInfo(() => DateTime.Now, DateTime.Now, "john@long", "1234")); - - var l_oBikeColl = new BikeCollectionMutable - { - new BikeInfoMutable(63, false, new List { "TINK" }, WheelType.Two, TypeOfBike.Allround), - new BikeInfoMutable(57, false, new List { "TINK" }, WheelType.Trike, TypeOfBike.Cargo), - l_oBikeRequested, - }; - - // Verify initial state - Assert.NotNull(l_oBikeColl.GetById("63")); - Assert.AreEqual(InUseStateEnum.Disposable, l_oBikeColl.GetById("57").State.Value); - Assert.AreEqual(InUseStateEnum.Reserved, l_oBikeColl.GetById("20").State.Value); - Assert.Null(l_oBikeColl.GetById("33")); - - l_oBikeColl.Update(null); - - // Verify modified state - Assert.Null(l_oBikeColl.GetById("63")); - Assert.Null(l_oBikeColl.GetById("57")); - Assert.Null(l_oBikeColl.GetById("20")); - Assert.Null(l_oBikeColl.GetById("33")); - } - - [Test] - public void TestUpdate() - { - var l_oBikeRequested = new BikeInfoMutable(20, false, new List { "TINK" }, WheelType.Trike, TypeOfBike.Allround); - l_oBikeRequested.State.Load(new StateInfo(() => DateTime.Now, DateTime.Now, "john@long", "1234")); - - var l_oBikeColl = new BikeCollectionMutable - { - new BikeInfoMutable(63, false, new List { "TINK" }, WheelType.Two, TypeOfBike.Allround), - new BikeInfoMutable(57, false, new List { "TINK" }, WheelType.Trike, TypeOfBike.Cargo), - l_oBikeRequested, - }; - - // Verify initial state - Assert.NotNull(l_oBikeColl.GetById("63")); // Will be removed - Assert.AreEqual(InUseStateEnum.Disposable, l_oBikeColl.GetById("57").State.Value); // Will be requested - Assert.AreEqual(InUseStateEnum.Reserved, l_oBikeColl.GetById("20").State.Value); // Will be booked - Assert.Null(l_oBikeColl.GetById("33")); // - - var l_oBikeResponse = new List - { - new BikeInfo("57", false, new [] { "TINK" }, WheelType.Trike, TypeOfBike.Allround, "Test description", 7, DateTime.Now, "john@long,", "1234"), - new BikeInfo("20", false, new [] {"TINK" }, WheelType.Trike, TypeOfBike.Allround, "Test description", 7, DateTime.Now, "john@long,", "1234"), - new BikeInfo("33", 7, false, new [] {"TINK" }, WheelType.Trike, TypeOfBike.Allround), - }; - - l_oBikeColl.Update(l_oBikeResponse); - - // Verify modified state - Assert.Null(l_oBikeColl.GetById("63")); - Assert.AreEqual(InUseStateEnum.Booked, l_oBikeColl.GetById("57").State.Value); - Assert.AreEqual(InUseStateEnum.Booked, l_oBikeColl.GetById("20").State.Value); - Assert.NotNull(l_oBikeColl.GetById("33")); - } - } -} diff --git a/TestTINKLib/Fixtures/ObjectTests/Bike/TestBikeMutable.cs b/TestTINKLib/Fixtures/ObjectTests/Bike/TestBikeMutable.cs deleted file mode 100644 index 2337035..0000000 --- a/TestTINKLib/Fixtures/ObjectTests/Bike/TestBikeMutable.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System; -using System.Collections.Generic; -using NUnit.Framework; -using TINK.Model.Bike; -using TINK.Model.State; - -using BikeInfoMutable = TINK.Model.Bike.BC.BikeInfoMutable; - -namespace TestTINKLib -{ - - /// - /// Moved to TestShareeLib (.Net Core) - /// - [TestFixture] - class TestBikeMutable - { - [Test] - public void TestConstruct() - { - var l_oBike = new BikeInfoMutable( - 42, - false, - new List { "TINK" }, - WheelType.Two, - TypeOfBike.Cargo); - - Assert.AreEqual(42, l_oBike.Id); - Assert.IsFalse(l_oBike.IsDemo); - Assert.AreEqual(WheelType.Two, l_oBike.WheelType); - Assert.AreEqual(TypeOfBike.Cargo, l_oBike.TypeOfBike); - Assert.AreEqual(InUseStateEnum.Disposable, l_oBike.State.Value); - Assert.IsNull(l_oBike.CurrentStation); - - l_oBike = new BikeInfoMutable( - 17, - true, - new List { "TINK" }, - WheelType.Mono, - TypeOfBike.Allround, - "Test description", - 1); - - Assert.AreEqual(17, l_oBike.Id); - Assert.IsTrue(l_oBike.IsDemo); - Assert.AreEqual(WheelType.Mono, l_oBike.WheelType); - Assert.AreEqual(TypeOfBike.Allround, l_oBike.TypeOfBike); - Assert.AreEqual(InUseStateEnum.Disposable, l_oBike.State.Value); - Assert.AreEqual(1, l_oBike.CurrentStation); - } - - [Test] - public void TestToString() - { - var l_oBike = new BikeInfoMutable(3, false, new List { "TINK" }, WheelType.Two, TypeOfBike.Cargo, p_oDateTimeProvider: () => new DateTime(1970, 1, 1)); - - Assert.AreEqual( - "Id=3, wheel(s)=Two, type=Cargo, demo=False, state=Disposable, location=On the road.", - l_oBike.ToString()); - - l_oBike = new BikeInfoMutable(3, true, new List { "TINK" }, WheelType.Trike, TypeOfBike.Allround, "Test description", 5, p_oDateTimeProvider: () => new DateTime(1970, 1, 1)); - Assert.AreEqual( - "Id=3, wheel(s)=Trike, type=Allround, demo=True, state=Disposable, location=Station 5.", - l_oBike.ToString()); - } - } -} diff --git a/TestTINKLib/Fixtures/ObjectTests/Bike/TestBikesAvailableResponse.cs b/TestTINKLib/Fixtures/ObjectTests/Bike/TestBikesAvailableResponse.cs deleted file mode 100644 index 1f52744..0000000 --- a/TestTINKLib/Fixtures/ObjectTests/Bike/TestBikesAvailableResponse.cs +++ /dev/null @@ -1,69 +0,0 @@ -using Newtonsoft.Json; -using NUnit.Framework; -using TINK.Repository.Response; - -namespace TestTINKLib.Fixtures.ObjectTests.Bike -{ - /// - /// Moved to TestShareeLib (.Net Core) - /// - [TestFixture] - public class TestBikesAvailableResponse - { - [Test] - public void TestDeserializeStationEmpty() - { - // Response for bike 231 is a real world answer. - var l_oBikes = JsonConvert.DeserializeObject(@" - { - ""apiserver"" : ""https://app.tink-konstanz.de"", - ""response"" : ""bikes_available"", - ""bikes"" : { - ""231"" : { - ""bike"" : ""231"", - ""description"" : ""Stadtrad"", - ""system"" : ""BC"", - ""bike_group"" : [ ""Konrad"" ], - ""station"" : """", - ""state"" : ""available"", - ""gps"" : { ""latitude"": ""9.1594501"", ""longitude"": ""47.6749928"" } - } - }, - ""copri_version"" : ""4.1.0.0"", - ""authcookie"" : """", - ""response_state"" : ""OK"" - } - "); - - Assert.IsNull(l_oBikes.bikes[231].station); - } - - [Test] - public void TestDeserializeStationInfoMissing() - { - // Response for bike 231 might not be real world answer. - var l_oBikes = JsonConvert.DeserializeObject(@" - { - ""apiserver"" : ""https://app.tink-konstanz.de"", - ""response"" : ""bikes_available"", - ""bikes"" : { - ""231"" : { - ""bike"" : ""231"", - ""description"" : ""Stadtrad"", - ""system"" : ""BC"", - ""bike_group"" : [ ""Konrad"" ], - ""state"" : ""available"", - ""gps"" : { ""latitude"": ""9.1594501"", ""longitude"": ""47.6749928"" } - } - }, - ""copri_version"" : ""4.1.0.0"", - ""authcookie"" : """", - ""response_state"" : ""OK"" - } - "); - - Assert.IsNull(l_oBikes.bikes[231].station); - - } - } -} diff --git a/TestTINKLib/Fixtures/ObjectTests/Bike/TestStateBookedInfoSerializeJSON.cs b/TestTINKLib/Fixtures/ObjectTests/Bike/TestStateBookedInfoSerializeJSON.cs deleted file mode 100644 index 65a8bbd..0000000 --- a/TestTINKLib/Fixtures/ObjectTests/Bike/TestStateBookedInfoSerializeJSON.cs +++ /dev/null @@ -1,44 +0,0 @@ -using Newtonsoft.Json; -using NUnit.Framework; -using System; -using TINK.Model.State; - - -namespace TestTINKLib.Fixtures.Bike -{ - /// - /// Moved to TestShareeLib (.Net Core) - /// - [TestFixture] - public class TestStateBookedInfoSerializeJSON - { - [Test] - public void TestSerializeJSON() - { - // Create object to test. - var l_oInfoSource = new StateOccupiedInfo( - new DateTime(2017, 09, 20, 23, 05, 0), - "Heinz@mueller", - "17 xxb"); - - // Serialize object and verify. - var l_oDetected = JsonConvert.SerializeObject(l_oInfoSource); - const string EXPECTED = @" - { - ""From"":""2017 - 09 - 20T23: 05:00"", - ""MailAddress"":""Heinz@mueller"", - ""Code"":""17 xxb"" - }"; - Assert.AreEqual( - TestHelper.PrepareXmlForStringCompare(EXPECTED.Replace("\n", string.Empty).Replace("\r", string.Empty)), - TestHelper.PrepareXmlForStringCompare(l_oDetected.Replace("\n", string.Empty).Replace("\r", string.Empty))); - - // Deserialize object and verify. - var l_oInfoTarget = JsonConvert.DeserializeObject(l_oDetected); - Assert.AreEqual(InUseStateEnum.Booked, l_oInfoTarget.Value); - Assert.AreEqual("Heinz@mueller", l_oInfoTarget.MailAddress); - Assert.AreEqual("17 xxb", l_oInfoTarget.Code); - Assert.AreEqual(new DateTime(2017, 9, 20, 23, 5, 0), l_oInfoTarget.From); - } - } -} diff --git a/TestTINKLib/Fixtures/ObjectTests/ViewModel/TestBikeAtStationViewModel.cs b/TestTINKLib/Fixtures/ObjectTests/ViewModel/TestBikeAtStationViewModel.cs index 9307ca2..9efc88a 100644 --- a/TestTINKLib/Fixtures/ObjectTests/ViewModel/TestBikeAtStationViewModel.cs +++ b/TestTINKLib/Fixtures/ObjectTests/ViewModel/TestBikeAtStationViewModel.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using NUnit.Framework; -using Rhino.Mocks; using TestFramework.Model.User.Account; using TINK.Model.Bikes.BikeInfoNS.BikeNS; using TINK.Model.Bikes.BikeInfoNS.DriveNS; @@ -78,7 +77,7 @@ namespace UITest.Fixtures.ViewModel l_oBike, l_oUser, new MyBikeInUseStateInfoProvider(), - MockRepository.GenerateStub(), + NSubstitute.Substitute.For(), url => { }); Assert.AreEqual("2", l_oViewModel.Name); @@ -105,7 +104,7 @@ namespace UITest.Fixtures.ViewModel bike, user, new BikeAtStationInUseStateInfoProvider(), - MockRepository.GenerateStub(), + NSubstitute.Substitute.For(), url => { })); Assert.AreEqual("Still 15 min. reserved.", l_oViewModel.StateText); @@ -128,7 +127,7 @@ namespace UITest.Fixtures.ViewModel bike, user, new BikeAtStationInUseStateInfoProvider(), - MockRepository.GenerateStub(), + NSubstitute.Substitute.For(), url => { })); Assert.AreEqual("Code 4asdfA, still 7 min. reserved.", l_oViewModel.StateText); @@ -151,7 +150,7 @@ namespace UITest.Fixtures.ViewModel bike, user, new BikeAtStationInUseStateInfoProvider(), - MockRepository.GenerateStub(), + NSubstitute.Substitute.For(), url => { })); Assert.AreEqual( @@ -188,7 +187,7 @@ namespace UITest.Fixtures.ViewModel l_oStoreMock.Load().Result, "123456789"), // Device id new BikeAtStationInUseStateInfoProvider(), - MockRepository.GenerateStub(), + NSubstitute.Substitute.For(), url => { }); Assert.AreEqual("Test description", l_oViewModel.Name); @@ -227,7 +226,7 @@ namespace UITest.Fixtures.ViewModel l_oStoreMock.Load().Result, "123456789"), new BikeAtStationInUseStateInfoProvider(), - MockRepository.GenerateStub(), + NSubstitute.Substitute.For(), url => { }); Assert.AreEqual("Test description", l_oViewModel.Name); diff --git a/TestTINKLib/Fixtures/ObjectTests/ViewModel/TestViewModelHelper.cs b/TestTINKLib/Fixtures/ObjectTests/ViewModel/TestViewModelHelper.cs deleted file mode 100644 index 376ab2b..0000000 --- a/TestTINKLib/Fixtures/ObjectTests/ViewModel/TestViewModelHelper.cs +++ /dev/null @@ -1,84 +0,0 @@ -using NUnit.Framework; -using Rhino.Mocks; -using TINK.Model.Bikes.BikeInfoNS.BC; -using TINK.Model.Bikes.BikeInfoNS.BikeNS; -using TINK.ViewModel; - -namespace UITest.Fixtures.ObjectTests.ViewModel -{ - - [TestFixture] - public class TestViewModelHelper - { - [Test] - public void TestGetDisplayName_DefinedTypes() - { - var l_oBike = MockRepository.GenerateStub(); - l_oBike.Stub(x => x.WheelType).Return(WheelType.Two); - l_oBike.Stub(x => x.TypeOfBike).Return(TypeOfBike.City); - l_oBike.Stub(x => x.Description).Return("MeinStadtrad"); - l_oBike.Stub(x => x.Id).Return("22"); - Assert.AreEqual( - "MeinStadtrad", - l_oBike.GetDisplayName()); - - Assert.AreEqual( - "22", - l_oBike.GetDisplayId()); - - l_oBike = MockRepository.GenerateStub(); - l_oBike.Stub(x => x.WheelType).Return(WheelType.Two); - l_oBike.Stub(x => x.TypeOfBike).Return(TypeOfBike.City); - l_oBike.Stub(x => x.Id).Return("22"); - l_oBike.Stub(x => x.IsDemo).Return(true); - l_oBike.Stub(x => x.Description).Return("MeinStadtrad"); - Assert.AreEqual( - "MeinStadtrad", - l_oBike.GetDisplayName()); - Assert.AreEqual( - "22", - l_oBike.GetDisplayId()); - - l_oBike = MockRepository.GenerateStub(); - l_oBike.Stub(x => x.WheelType).Return(WheelType.Trike); - l_oBike.Stub(x => x.TypeOfBike).Return(TypeOfBike.Cargo); - l_oBike.Stub(x => x.Description).Return("MeinCargoDreiradl"); - l_oBike.Stub(x => x.Id).Return("22"); - Assert.AreEqual( - "MeinCargoDreiradl", - l_oBike.GetDisplayName()); - Assert.AreEqual( - "22", - l_oBike.GetDisplayId()); - - l_oBike = MockRepository.GenerateStub(); - l_oBike.Stub(x => x.WheelType).Return(WheelType.Two); - l_oBike.Stub(x => x.TypeOfBike).Return(TypeOfBike.Cargo); - l_oBike.Stub(x => x.Description).Return("MeinCargoALololong"); - l_oBike.Stub(x => x.Id).Return("22"); - Assert.AreEqual( - "MeinCargoALololong", - l_oBike.GetDisplayName()); - Assert.AreEqual( - "22", - l_oBike.GetDisplayId()); - } - - [Test] - public void TestGetDisplayName_UndefinedTypes() - { - var l_oBike = MockRepository.GenerateStub(); - l_oBike.Stub(x => x.WheelType).Return(WheelType.Mono); - l_oBike.Stub(x => x.TypeOfBike).Return(TypeOfBike.Cargo); - l_oBike.Stub(x => x.Description).Return("SuperCargo"); - l_oBike.Stub(x => x.Id).Return("22"); - Assert.AreEqual( - "SuperCargo", - l_oBike.GetDisplayName()); - - Assert.AreEqual( - "22", - l_oBike.GetDisplayId()); - } - } -} diff --git a/TestTINKLib/TestTINKLib.csproj b/TestTINKLib/TestTINKLib.csproj index 52ffeb1..003169e 100644 --- a/TestTINKLib/TestTINKLib.csproj +++ b/TestTINKLib/TestTINKLib.csproj @@ -40,84 +40,33 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -185,7 +134,13 @@ + + + + + +