public void UpdateCheckServiceReturnsCurrentVersion() { var service = new UpdateCheckService( A.Fake <ILogger <UpdateCheckService> >(), A.Fake <IConfiguration>(), A.Fake <HttpClient>() ); Assert.Equal(Assembly.GetEntryAssembly()? .GetCustomAttribute <AssemblyInformationalVersionAttribute>()? .InformationalVersion, service.CurrentVersion); }
/// <summary> /// Initializes a new instance of the <see cref="SelectorWindowViewModel"/> class. /// </summary> public SelectorWindowViewModel() { _inspectionService = ServiceLocator.Resolve <InspectionService>(); _updateCheckService = ServiceLocator.Resolve <UpdateCheckService>(); UpdateInformation = _updateCheckService.UpdateInformation; _managedApplicationsService = new ManagedApplicationsService(); ManagedApplicationsInfo = _managedApplicationsService.ManagerApplicationsInfo; ManagedApplicationsInfo.ManagedApplicationInfos.CurrentChanged += (s, e) => InspectCommand.RaiseCanExecuteChanged(); ManagedApplicationsInfo.ManagedApplicationInfos.CollectionChanged += (s, e) => { if (ManagedApplicationsInfo.ManagedApplicationInfos.CurrentItem == null) { ManagedApplicationsInfo.ManagedApplicationInfos.MoveCurrentToFirst(); } }; RefreshCommand = new Command <object>(RefreshApplicationList); InspectCommand = new Command <object>(_ => Inspect(), _ => ManagedApplicationsInfo.ManagedApplicationInfos.CurrentItem != null); ExitCommand = new Command <object>(o => Application.Current.Shutdown()); AboutCommand = new Command <object>(o => new AboutWindow().ShowDialog()); VisitWebpageCommand = new Command <object>(VisitWebPage); }
public void DeserializeUpdateData_ReturnsCorrectData() { // Arrange var testInputData = @"<UpdateData> <LatestVersionMajorPart>1</LatestVersionMajorPart> <LatestVersionMinorPart>3</LatestVersionMinorPart> <ReleaseDate>2015-07-01</ReleaseDate> <DownloadUrl>http://www.google.com</DownloadUrl> <ReleaseNotes>* Release notes line 1 * Release notes line 2 * More really great release notes!</ReleaseNotes> </UpdateData>"; var expectedResult = new UpdateData { LatestVersionMajorPart = 1, LatestVersionMinorPart = 3, DownloadUrl = "http://www.google.com", ReleaseDate = new DateTime(2015, 7, 1), ReleaseNotes = @"* Release notes line 1 * Release notes line 2 * More really great release notes!" }; var mockHTTPService = new Mock <IHTTPService>(); var service = new UpdateCheckService(mockHTTPService.Object); // Act var result = service.DeserializeUpdateData(testInputData); // Assert Assert.AreEqual(expectedResult.LatestVersionMajorPart, result.LatestVersionMajorPart); Assert.AreEqual(expectedResult.LatestVersionMinorPart, result.LatestVersionMinorPart); Assert.AreEqual(expectedResult.DownloadUrl, result.DownloadUrl); Assert.AreEqual(expectedResult.ReleaseDate, result.ReleaseDate); Assert.AreEqual(expectedResult.ReleaseNotes, result.ReleaseNotes); }