From 5bdb5af3b5da4a3c01b22215548f1f2329c539cb Mon Sep 17 00:00:00 2001 From: SandRock Date: Fri, 10 Mar 2023 10:35:45 +0100 Subject: [PATCH 01/34] migrate csproj to sdk version, move files around, migrate code, comment non-migrated code... #20 --- .../TwitterUsernameAttributeTests.cs | 167 -------- .../SrkDateTimeExtensionsTests.cs | 363 ------------------ .../Modules/CrawlerGhostingModule.cs | 35 -- .../NSTD.SrkToolkit.AspNetCore.csproj | 46 +-- ...{SrkToolkit.VS15.sln => SrkToolkit-v2.sln} | 272 ++++++++----- .../ChangeCurrentCulture.cs | 0 .../DecimalModelBinderTests.cs | 31 +- .../IntegerModelBinderTests.cs | 0 .../OpenGraphNameTests.cs | 0 .../OpenGraphNamespaceTests.cs | 0 .../OpenGraphObjectTests.cs | 0 .../OpenGraphTagTests.cs | 0 .../PageInfoTests.cs | 0 .../SrkHtmlExtensionsTests.cs | 0 .../SrkHttpContextExtensionsTests.cs | 184 ++++----- .../SrkMvcCollectionExtensionsTests.cs | 0 .../SrkRequestExtensionsTests.cs | 0 .../SrkToolkit.AspNetCore2.UnitTests.csproj | 39 ++ .../SrkUrlHelperExtensionsTests.cs | 0 .../WebDependenciesTests.cs | 0 .../SrkToolkit.Common.CoreUnitTests.csproj | 99 +++++ .../SrkToolkit.Common.FxUnitTests/App.config | 58 +++ .../AssertTests.cs | 149 ++++--- .../CompositeDisposableTests.cs | 21 +- .../CultureInfoHelperTests.cs | 37 +- .../CultureInfoAttributeTests.cs | 43 +-- .../EmailAddressExAttributeTests.cs | 103 +++-- .../PhoneNumberAttributeTests.cs | 87 +++-- .../DataAnnotations/TimezoneAttributeTests.cs | 33 +- .../TwitterUsernameAttributeTests.cs | 163 ++++++++ .../DateRangeAttributeTests.cs | 139 ++++--- .../DictionaryWrapperTests.cs | 58 +-- .../DisaposableOnceTests.cs | 20 +- .../EmailAddressAttributeTests.cs | 82 ++-- .../EmailAddressTests.cs | 233 +++++------ .../EnumStrings.Designer.cs | 3 +- .../EnumStrings.fr.resx | 0 .../EnumStrings.resx | 0 .../EnumToolsTests.cs | 44 +-- .../ObservableCollectionExtensionsTests.cs | 54 +-- .../Properties/AssemblyInfo.cs | 35 ++ .../RetryLogicTests.NET4.cs | 11 +- .../SrkArrayExtensionsTests.cs | 118 +++--- .../SrkDateTimeExtensionsTests.cs | 356 +++++++++++++++++ .../SrkIDictionaryExtensionsTests.cs | 137 ++++--- .../SrkIListExtensionsTests.cs | 142 +++---- .../SrkNameValueCollectionExtensions.cs | 26 +- .../SrkStringExtensionsTests.cs | 124 +++--- .../SrkStringTransformer.cs | 348 ++++++++--------- .../SrkTimeZoneInfoExtensionsTests.cs | 168 ++++---- .../SrkToolkit.Common.FxUnitTests.csproj | 99 +++++ .../StringReplacerTests.cs | 59 ++- .../ValidateTEsts.cs | 83 ++-- .../Collections/DictionaryWrapper.cs | 0 .../CompositeDisposable.cs | 0 .../DataAnnotations/CultureInfoAttribute.cs | 3 + .../DataAnnotations/DateRangeAttribute.cs | 3 + .../DataAnnotations/Dummy.cs | 12 + .../DataAnnotations/EmailAddressAttribute.cs | 32 +- .../DataAnnotations/PhoneNumberAttribute.cs | 3 + .../DataAnnotations/TimezoneAttribute.cs | 3 + .../TwitterUsernameAttribute.cs | 3 + .../DisposableOnce.cs | 0 .../EnumTools.cs | 0 .../Globalization/CultureInfoHelper.cs | 0 Sources/SrkToolkit.Common/IO/Dummy.cs | 12 + .../IO/RecursiveDelete.cs | 3 + .../Internals/Nothing.cs | 0 .../Internals/RetryLogicState.cs | 0 .../Resources/Strings.Designer.cs | 3 +- .../Resources/Strings.fr.resx | 0 .../Resources/Strings.resx | 0 .../RetryIntervalStrategy.cs | 0 .../RetryLogic.cs | 0 .../SrkToolkit.Common.csproj | 37 ++ .../StringComparerEx.cs | 0 .../StringReplacer.cs | 0 .../SrkIDictionaryExtensions.cs | 0 .../SrkIListExtensions.cs | 0 .../SrkObservableCollectionExtensions.cs | 0 .../SrkNameValueCollectionExtensions.cs | 0 .../SrkIDictionaryExtensions.cs | 0 .../System.Diagnostics/StopwatchExtensions.cs | 0 .../System.Linq/SrkEnumerable.cs | 0 .../System/DateTimePrecision.cs | 0 .../System/SrkArrayExtensions.cs | 0 .../System/SrkDateTimeExtensions.cs | 0 .../System/SrkExceptionExtensions.cs | 0 .../System/SrkStringExtensions.cs | 0 .../System/SrkTimeZoneInfoExtensions.cs | 0 .../System/StringTransformer.Urls.cs | 0 .../System/StringTransformer.cs | 0 .../Testing/Assert.cs | 0 .../Threading.Tasks/TaskEx.cs | 0 .../Validation/EmailAddressUtility.cs | 0 .../Validation/Validate.cs | 0 .../MessageDisplayMode.cs | 0 .../SrkDomainControllerExtensions.cs | 4 +- .../SrkToolkit.Domain.AspNetCore2.csproj | 38 ++ .../BaseRequestTests.cs | 24 +- .../BaseResultTests.cs | 164 ++++---- .../BasicResultTests.cs | 10 +- .../ResultErrorExtensionsTests.cs | 85 ++-- .../ResultErrorTests.cs | 74 ++-- .../SrkToolkit.Domain.CoreUnitTests.csproj | 35 ++ .../Strings.Designer.cs | 3 +- .../Strings.resx | 0 .../BaseRequest.cs | 0 .../BaseResult.cs | 0 .../BasicResult.TResultCode.Payload.cs | 0 .../BasicResult.TResultCode.cs | 0 .../BasicResult.cs | 0 .../BasicResultError.cs | 0 .../BasicResultExtensions.cs | 0 .../IBaseResult.cs | 0 .../IResultError.cs | 0 .../Internals/Names.cs | 0 .../ResultError.cs | 0 .../ResultErrorExtensions.cs | 0 .../SrkToolkit.Domain.csproj | 33 ++ .../NavigationLine.cs | 2 +- .../NavigationLineEntry.cs | 2 +- .../Open/OpenGraphName.cs | 0 .../Open/OpenGraphNamespace.cs | 0 .../Open/OpenGraphObject.cs | 0 .../Open/OpenGraphTag.cs | 0 .../Open/PageInfo.cs | 5 + .../Open/PageInfoItem.cs | 0 .../Open/PageInfoObject.cs | 15 +- .../Open/SrkOpenGraphHtmlExtensions.cs | 8 + .../SrkRequestExtensions.cs | 0 .../SrkToolkit.Web.AspMvc5.csproj | 26 ++ .../Fakes/BasicHttpContext.cs | 0 .../Fakes/BasicHttpRequest.cs | 0 .../Fakes/BasicHttpSessionState.cs | 0 .../Filters/AuthorizeAttribute.cs | 0 .../HttpErrors/BaseErrorController.cs | 0 .../HttpErrors/BasicHttpErrorResponse.cs | 0 .../HttpErrors/ErrorControllerHandler.cs | 0 .../HttpErrors/IErrorController.cs | 0 .../SrkToolkit.Web.AspNetCore2/Internals.cs | 9 + .../JsonNetResult.cs | 3 +- .../Models/HttpErrorModel.cs | 0 .../Models/TempMessage.cs | 0 .../Mvc/DecimalModelBinder.cs | 2 + .../SrkToolkit.Web.AspNetCore2/Mvc/Dummy.cs | 12 + .../Mvc/IntegerModelBinder.cs | 0 .../Services/BaseSessionService.cs | 1 - .../DictionarySessionServiceSource.cs | 0 .../Services/HttpBaseSessionServiceSource.cs | 0 .../Services/IResultService.cs | 2 +- .../Services/ISessionServiceSource.cs | 0 .../Services/ResultService.cs | 0 .../Services/ResultServiceBase.cs | 11 +- .../SrkControllerExtensions.cs | 17 +- .../SrkHtmlExtensions.cs | 247 ++++++------ .../SrkHttpApplication.cs | 0 .../SrkHttpApplication.tt | 0 .../SrkHttpApplication.tt.cs | 0 .../SrkHttpContextExtensions.cs | 43 ++- .../SrkHttpRequestExtensions.cs | 48 +++ .../SrkTempDataDictionaryExtensions.cs | 4 +- .../SrkToolkit.Web.AspNetCore2.csproj | 131 +++++++ .../SrkMvcCollectionExtensions.cs | 2 +- .../System.Web.Mvc/SrkTagBuilderExtensions.cs | 7 +- .../System.Web.Mvc/SrkUrlHelperExtensions.cs | 1 + .../System.Web.Mvc/SrkViewExtensions.cs | 2 +- .../WebDependencies.cs | 15 +- .../WebDependenciesExtensions.cs | 1 - .../WebDependency.cs | 0 .../WebDependencyFile.cs | 0 171 files changed, 3164 insertions(+), 2305 deletions(-) delete mode 100644 Sources/NET4.SrkToolkit.Common.Tests/DataAnnotations/TwitterUsernameAttributeTests.cs delete mode 100644 Sources/NET4.SrkToolkit.Common.Tests/SrkDateTimeExtensionsTests.cs delete mode 100644 Sources/NET4.SrkToolkit.Web/Modules/CrawlerGhostingModule.cs rename Sources/{SrkToolkit.VS15.sln => SrkToolkit-v2.sln} (65%) rename Sources/{NET4.SrkToolkit.Web.Tests => SrkToolkit.AspNetCore2.UnitTests}/ChangeCurrentCulture.cs (100%) rename Sources/{NET4.SrkToolkit.Web.Tests => SrkToolkit.AspNetCore2.UnitTests}/DecimalModelBinderTests.cs (94%) rename Sources/{NET4.SrkToolkit.Web.Tests => SrkToolkit.AspNetCore2.UnitTests}/IntegerModelBinderTests.cs (100%) rename Sources/{NET4.SrkToolkit.Web.Tests => SrkToolkit.AspNetCore2.UnitTests}/OpenGraphNameTests.cs (100%) rename Sources/{NET4.SrkToolkit.Web.Tests => SrkToolkit.AspNetCore2.UnitTests}/OpenGraphNamespaceTests.cs (100%) rename Sources/{NET4.SrkToolkit.Web.Tests => SrkToolkit.AspNetCore2.UnitTests}/OpenGraphObjectTests.cs (100%) rename Sources/{NET4.SrkToolkit.Web.Tests => SrkToolkit.AspNetCore2.UnitTests}/OpenGraphTagTests.cs (100%) rename Sources/{NET4.SrkToolkit.Web.Tests => SrkToolkit.AspNetCore2.UnitTests}/PageInfoTests.cs (100%) rename Sources/{NET4.SrkToolkit.Web.Tests => SrkToolkit.AspNetCore2.UnitTests}/SrkHtmlExtensionsTests.cs (100%) rename Sources/{NET4.SrkToolkit.Web.Tests => SrkToolkit.AspNetCore2.UnitTests}/SrkHttpContextExtensionsTests.cs (97%) rename Sources/{NET4.SrkToolkit.Web.Tests => SrkToolkit.AspNetCore2.UnitTests}/SrkMvcCollectionExtensionsTests.cs (100%) rename Sources/{NET4.SrkToolkit.Web.Tests => SrkToolkit.AspNetCore2.UnitTests}/SrkRequestExtensionsTests.cs (100%) create mode 100644 Sources/SrkToolkit.AspNetCore2.UnitTests/SrkToolkit.AspNetCore2.UnitTests.csproj rename Sources/{NET4.SrkToolkit.Web.Tests => SrkToolkit.AspNetCore2.UnitTests}/SrkUrlHelperExtensionsTests.cs (100%) rename Sources/{NET4.SrkToolkit.Web.Tests => SrkToolkit.AspNetCore2.UnitTests}/WebDependenciesTests.cs (100%) create mode 100644 Sources/SrkToolkit.Common.CoreUnitTests/SrkToolkit.Common.CoreUnitTests.csproj create mode 100644 Sources/SrkToolkit.Common.FxUnitTests/App.config rename Sources/{NET4.SrkToolkit.Common.Tests => SrkToolkit.Common.FxUnitTests}/AssertTests.cs (69%) rename Sources/{NET4.SrkToolkit.Common.Tests => SrkToolkit.Common.FxUnitTests}/CompositeDisposableTests.cs (86%) rename Sources/{NET4.SrkToolkit.Common.Tests => SrkToolkit.Common.FxUnitTests}/CultureInfoHelperTests.cs (66%) rename Sources/{NET4.SrkToolkit.Common.Tests => SrkToolkit.Common.FxUnitTests}/DataAnnotations/CultureInfoAttributeTests.cs (72%) rename Sources/{NET4.SrkToolkit.Common.Tests => SrkToolkit.Common.FxUnitTests}/DataAnnotations/EmailAddressExAttributeTests.cs (79%) rename Sources/{NET4.SrkToolkit.Common.Tests => SrkToolkit.Common.FxUnitTests}/DataAnnotations/PhoneNumberAttributeTests.cs (64%) rename Sources/{NET4.SrkToolkit.Common.Tests => SrkToolkit.Common.FxUnitTests}/DataAnnotations/TimezoneAttributeTests.cs (72%) create mode 100644 Sources/SrkToolkit.Common.FxUnitTests/DataAnnotations/TwitterUsernameAttributeTests.cs rename Sources/{NET4.SrkToolkit.Common.Tests => SrkToolkit.Common.FxUnitTests}/DateRangeAttributeTests.cs (77%) rename Sources/{NET4.SrkToolkit.Common.Tests => SrkToolkit.Common.FxUnitTests}/DictionaryWrapperTests.cs (64%) rename Sources/{NET4.SrkToolkit.Common.Tests => SrkToolkit.Common.FxUnitTests}/DisaposableOnceTests.cs (74%) rename Sources/{NET4.SrkToolkit.Common.Tests => SrkToolkit.Common.FxUnitTests}/EmailAddressAttributeTests.cs (74%) rename Sources/{NET4.SrkToolkit.Common.Tests => SrkToolkit.Common.FxUnitTests}/EmailAddressTests.cs (68%) rename Sources/{NET4.SrkToolkit.Common.Tests => SrkToolkit.Common.FxUnitTests}/EnumStrings.Designer.cs (95%) rename Sources/{NET4.SrkToolkit.Common.Tests => SrkToolkit.Common.FxUnitTests}/EnumStrings.fr.resx (100%) rename Sources/{NET4.SrkToolkit.Common.Tests => SrkToolkit.Common.FxUnitTests}/EnumStrings.resx (100%) rename Sources/{NET4.SrkToolkit.Common.Tests => SrkToolkit.Common.FxUnitTests}/EnumToolsTests.cs (78%) rename Sources/{NET4.SrkToolkit.Common.Tests => SrkToolkit.Common.FxUnitTests}/ObservableCollectionExtensionsTests.cs (66%) create mode 100644 Sources/SrkToolkit.Common.FxUnitTests/Properties/AssemblyInfo.cs rename Sources/{NET4.SrkToolkit.Common.Tests => SrkToolkit.Common.FxUnitTests}/RetryLogicTests.NET4.cs (96%) rename Sources/{NET4.SrkToolkit.Common.Tests => SrkToolkit.Common.FxUnitTests}/SrkArrayExtensionsTests.cs (51%) create mode 100644 Sources/SrkToolkit.Common.FxUnitTests/SrkDateTimeExtensionsTests.cs rename Sources/{NET4.SrkToolkit.Common.Tests => SrkToolkit.Common.FxUnitTests}/SrkIDictionaryExtensionsTests.cs (67%) rename Sources/{NET4.SrkToolkit.Common.Tests => SrkToolkit.Common.FxUnitTests}/SrkIListExtensionsTests.cs (64%) rename Sources/{NET4.SrkToolkit.Common.Tests => SrkToolkit.Common.FxUnitTests}/SrkNameValueCollectionExtensions.cs (64%) rename Sources/{NET4.SrkToolkit.Common.Tests => SrkToolkit.Common.FxUnitTests}/SrkStringExtensionsTests.cs (63%) rename Sources/{NET4.SrkToolkit.Common.Tests => SrkToolkit.Common.FxUnitTests}/SrkStringTransformer.cs (77%) rename Sources/{NET4.SrkToolkit.Common.Tests => SrkToolkit.Common.FxUnitTests}/SrkTimeZoneInfoExtensionsTests.cs (50%) create mode 100644 Sources/SrkToolkit.Common.FxUnitTests/SrkToolkit.Common.FxUnitTests.csproj rename Sources/{NET4.SrkToolkit.Common.Tests => SrkToolkit.Common.FxUnitTests}/StringReplacerTests.cs (86%) rename Sources/{NET4.SrkToolkit.Common.Tests => SrkToolkit.Common.FxUnitTests}/ValidateTEsts.cs (72%) rename Sources/{NET4.SrkToolkit.Common => SrkToolkit.Common}/Collections/DictionaryWrapper.cs (100%) rename Sources/{NET4.SrkToolkit.Common => SrkToolkit.Common}/CompositeDisposable.cs (100%) rename Sources/{NET4.SrkToolkit.Common => SrkToolkit.Common}/DataAnnotations/CultureInfoAttribute.cs (95%) rename Sources/{NET4.SrkToolkit.Common => SrkToolkit.Common}/DataAnnotations/DateRangeAttribute.cs (96%) create mode 100644 Sources/SrkToolkit.Common/DataAnnotations/Dummy.cs rename Sources/{NET4.SrkToolkit.Common => SrkToolkit.Common}/DataAnnotations/EmailAddressAttribute.cs (93%) rename Sources/{NET4.SrkToolkit.Common => SrkToolkit.Common}/DataAnnotations/PhoneNumberAttribute.cs (96%) rename Sources/{NET4.SrkToolkit.Common => SrkToolkit.Common}/DataAnnotations/TimezoneAttribute.cs (95%) rename Sources/{NET4.SrkToolkit.Common => SrkToolkit.Common}/DataAnnotations/TwitterUsernameAttribute.cs (96%) rename Sources/{NET4.SrkToolkit.Common => SrkToolkit.Common}/DisposableOnce.cs (100%) rename Sources/{NET4.SrkToolkit.Common => SrkToolkit.Common}/EnumTools.cs (100%) rename Sources/{NET4.SrkToolkit.Common => SrkToolkit.Common}/Globalization/CultureInfoHelper.cs (100%) create mode 100644 Sources/SrkToolkit.Common/IO/Dummy.cs rename Sources/{NET4.SrkToolkit.Common => SrkToolkit.Common}/IO/RecursiveDelete.cs (96%) rename Sources/{NET4.SrkToolkit.Common => SrkToolkit.Common}/Internals/Nothing.cs (100%) rename Sources/{NET4.SrkToolkit.Common => SrkToolkit.Common}/Internals/RetryLogicState.cs (100%) rename Sources/{NET4.SrkToolkit.Common => SrkToolkit.Common}/Resources/Strings.Designer.cs (96%) rename Sources/{NET4.SrkToolkit.Common => SrkToolkit.Common}/Resources/Strings.fr.resx (100%) rename Sources/{NET4.SrkToolkit.Common => SrkToolkit.Common}/Resources/Strings.resx (100%) rename Sources/{NET4.SrkToolkit.Common => SrkToolkit.Common}/RetryIntervalStrategy.cs (100%) rename Sources/{NET4.SrkToolkit.Common => SrkToolkit.Common}/RetryLogic.cs (100%) create mode 100644 Sources/SrkToolkit.Common/SrkToolkit.Common.csproj rename Sources/{NET4.SrkToolkit.Common => SrkToolkit.Common}/StringComparerEx.cs (100%) rename Sources/{NET4.SrkToolkit.Common => SrkToolkit.Common}/StringReplacer.cs (100%) rename Sources/{NET4.SrkToolkit.Common => SrkToolkit.Common}/System.Collections.Generic/SrkIDictionaryExtensions.cs (100%) rename Sources/{NET4.SrkToolkit.Common => SrkToolkit.Common}/System.Collections.Generic/SrkIListExtensions.cs (100%) rename Sources/{NET4.SrkToolkit.Common => SrkToolkit.Common}/System.Collections.ObjectModel/SrkObservableCollectionExtensions.cs (100%) rename Sources/{NET4.SrkToolkit.Common => SrkToolkit.Common}/System.Collections.Specialized/SrkNameValueCollectionExtensions.cs (100%) rename Sources/{NET4.SrkToolkit.Common => SrkToolkit.Common}/System.Collections/SrkIDictionaryExtensions.cs (100%) rename Sources/{NET4.SrkToolkit.Common => SrkToolkit.Common}/System.Diagnostics/StopwatchExtensions.cs (100%) rename Sources/{NET4.SrkToolkit.Common => SrkToolkit.Common}/System.Linq/SrkEnumerable.cs (100%) rename Sources/{NET4.SrkToolkit.Common => SrkToolkit.Common}/System/DateTimePrecision.cs (100%) rename Sources/{NET4.SrkToolkit.Common => SrkToolkit.Common}/System/SrkArrayExtensions.cs (100%) rename Sources/{NET4.SrkToolkit.Common => SrkToolkit.Common}/System/SrkDateTimeExtensions.cs (100%) rename Sources/{NET4.SrkToolkit.Common => SrkToolkit.Common}/System/SrkExceptionExtensions.cs (100%) rename Sources/{NET4.SrkToolkit.Common => SrkToolkit.Common}/System/SrkStringExtensions.cs (100%) rename Sources/{NET4.SrkToolkit.Common => SrkToolkit.Common}/System/SrkTimeZoneInfoExtensions.cs (100%) rename Sources/{NET4.SrkToolkit.Common => SrkToolkit.Common}/System/StringTransformer.Urls.cs (100%) rename Sources/{NET4.SrkToolkit.Common => SrkToolkit.Common}/System/StringTransformer.cs (100%) rename Sources/{NET4.SrkToolkit.Common => SrkToolkit.Common}/Testing/Assert.cs (100%) rename Sources/{NET4.SrkToolkit.Common => SrkToolkit.Common}/Threading.Tasks/TaskEx.cs (100%) rename Sources/{NET4.SrkToolkit.Common => SrkToolkit.Common}/Validation/EmailAddressUtility.cs (100%) rename Sources/{NET4.SrkToolkit.Common => SrkToolkit.Common}/Validation/Validate.cs (100%) rename Sources/{NET4.SrkToolkit.Domain.AspMvc4/SrkToolkit.Web => SrkToolkit.Domain.AspNetCore2}/MessageDisplayMode.cs (100%) rename Sources/{NET4.SrkToolkit.Domain.AspMvc4/SrkToolkit.Web => SrkToolkit.Domain.AspNetCore2}/SrkDomainControllerExtensions.cs (96%) create mode 100644 Sources/SrkToolkit.Domain.AspNetCore2/SrkToolkit.Domain.AspNetCore2.csproj rename Sources/{NET4.SrkToolkit.Domain.Tests => SrkToolkit.Domain.CoreUnitTests}/BaseRequestTests.cs (79%) rename Sources/{NET4.SrkToolkit.Domain.Tests => SrkToolkit.Domain.CoreUnitTests}/BaseResultTests.cs (75%) rename Sources/{NET4.SrkToolkit.Domain.Tests => SrkToolkit.Domain.CoreUnitTests}/BasicResultTests.cs (86%) rename Sources/{NET4.SrkToolkit.Domain.Tests => SrkToolkit.Domain.CoreUnitTests}/ResultErrorExtensionsTests.cs (60%) rename Sources/{NET4.SrkToolkit.Domain.Tests => SrkToolkit.Domain.CoreUnitTests}/ResultErrorTests.cs (73%) create mode 100644 Sources/SrkToolkit.Domain.CoreUnitTests/SrkToolkit.Domain.CoreUnitTests.csproj rename Sources/{NET4.SrkToolkit.Domain.Tests => SrkToolkit.Domain.CoreUnitTests}/Strings.Designer.cs (95%) rename Sources/{NET4.SrkToolkit.Domain.Tests => SrkToolkit.Domain.CoreUnitTests}/Strings.resx (100%) rename Sources/{NET4.SrkToolkit.Domain => SrkToolkit.Domain}/BaseRequest.cs (100%) rename Sources/{NET4.SrkToolkit.Domain => SrkToolkit.Domain}/BaseResult.cs (100%) rename Sources/{NET4.SrkToolkit.Domain => SrkToolkit.Domain}/BasicResult.TResultCode.Payload.cs (100%) rename Sources/{NET4.SrkToolkit.Domain => SrkToolkit.Domain}/BasicResult.TResultCode.cs (100%) rename Sources/{NET4.SrkToolkit.Domain => SrkToolkit.Domain}/BasicResult.cs (100%) rename Sources/{NET4.SrkToolkit.Domain => SrkToolkit.Domain}/BasicResultError.cs (100%) rename Sources/{NET4.SrkToolkit.Domain => SrkToolkit.Domain}/BasicResultExtensions.cs (100%) rename Sources/{NET4.SrkToolkit.Domain => SrkToolkit.Domain}/IBaseResult.cs (100%) rename Sources/{NET4.SrkToolkit.Domain => SrkToolkit.Domain}/IResultError.cs (100%) rename Sources/{NET4.SrkToolkit.Domain => SrkToolkit.Domain}/Internals/Names.cs (100%) rename Sources/{NET4.SrkToolkit.Domain => SrkToolkit.Domain}/ResultError.cs (100%) rename Sources/{NET4.SrkToolkit.Domain => SrkToolkit.Domain}/ResultErrorExtensions.cs (100%) create mode 100644 Sources/SrkToolkit.Domain/SrkToolkit.Domain.csproj rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspMvc5}/NavigationLine.cs (94%) rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspMvc5}/NavigationLineEntry.cs (94%) rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspMvc5}/Open/OpenGraphName.cs (100%) rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspMvc5}/Open/OpenGraphNamespace.cs (100%) rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspMvc5}/Open/OpenGraphObject.cs (100%) rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspMvc5}/Open/OpenGraphTag.cs (100%) rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspMvc5}/Open/PageInfo.cs (96%) rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspMvc5}/Open/PageInfoItem.cs (100%) rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspMvc5}/Open/PageInfoObject.cs (93%) rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspMvc5}/Open/SrkOpenGraphHtmlExtensions.cs (90%) rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspMvc5}/SrkRequestExtensions.cs (100%) create mode 100644 Sources/SrkToolkit.Web.AspMvc5/SrkToolkit.Web.AspMvc5.csproj rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspNetCore2}/Fakes/BasicHttpContext.cs (100%) rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspNetCore2}/Fakes/BasicHttpRequest.cs (100%) rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspNetCore2}/Fakes/BasicHttpSessionState.cs (100%) rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspNetCore2}/Filters/AuthorizeAttribute.cs (100%) rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspNetCore2}/HttpErrors/BaseErrorController.cs (100%) rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspNetCore2}/HttpErrors/BasicHttpErrorResponse.cs (100%) rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspNetCore2}/HttpErrors/ErrorControllerHandler.cs (100%) rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspNetCore2}/HttpErrors/IErrorController.cs (100%) create mode 100644 Sources/SrkToolkit.Web.AspNetCore2/Internals.cs rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspNetCore2}/JsonNetResult.cs (94%) rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspNetCore2}/Models/HttpErrorModel.cs (100%) rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspNetCore2}/Models/TempMessage.cs (100%) rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspNetCore2}/Mvc/DecimalModelBinder.cs (96%) create mode 100644 Sources/SrkToolkit.Web.AspNetCore2/Mvc/Dummy.cs rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspNetCore2}/Mvc/IntegerModelBinder.cs (100%) rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspNetCore2}/Services/BaseSessionService.cs (96%) rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspNetCore2}/Services/DictionarySessionServiceSource.cs (100%) rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspNetCore2}/Services/HttpBaseSessionServiceSource.cs (100%) rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspNetCore2}/Services/IResultService.cs (96%) rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspNetCore2}/Services/ISessionServiceSource.cs (100%) rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspNetCore2}/Services/ResultService.cs (100%) rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspNetCore2}/Services/ResultServiceBase.cs (94%) rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspNetCore2}/SrkControllerExtensions.cs (95%) rename Sources/{NET4.SrkToolkit.Web/System.Web.Mvc => SrkToolkit.Web.AspNetCore2}/SrkHtmlExtensions.cs (82%) rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspNetCore2}/SrkHttpApplication.cs (100%) rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspNetCore2}/SrkHttpApplication.tt (100%) rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspNetCore2}/SrkHttpApplication.tt.cs (100%) rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspNetCore2}/SrkHttpContextExtensions.cs (96%) create mode 100644 Sources/SrkToolkit.Web.AspNetCore2/SrkHttpRequestExtensions.cs rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspNetCore2}/SrkTempDataDictionaryExtensions.cs (96%) create mode 100644 Sources/SrkToolkit.Web.AspNetCore2/SrkToolkit.Web.AspNetCore2.csproj rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspNetCore2}/System.Web.Mvc/SrkMvcCollectionExtensions.cs (95%) rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspNetCore2}/System.Web.Mvc/SrkTagBuilderExtensions.cs (79%) rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspNetCore2}/System.Web.Mvc/SrkUrlHelperExtensions.cs (97%) rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspNetCore2}/System.Web.Mvc/SrkViewExtensions.cs (96%) rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspNetCore2}/WebDependencies.cs (93%) rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspNetCore2}/WebDependenciesExtensions.cs (96%) rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspNetCore2}/WebDependency.cs (100%) rename Sources/{NET4.SrkToolkit.Web => SrkToolkit.Web.AspNetCore2}/WebDependencyFile.cs (100%) diff --git a/Sources/NET4.SrkToolkit.Common.Tests/DataAnnotations/TwitterUsernameAttributeTests.cs b/Sources/NET4.SrkToolkit.Common.Tests/DataAnnotations/TwitterUsernameAttributeTests.cs deleted file mode 100644 index 6fa9391..0000000 --- a/Sources/NET4.SrkToolkit.Common.Tests/DataAnnotations/TwitterUsernameAttributeTests.cs +++ /dev/null @@ -1,167 +0,0 @@ - -namespace Sparkle.UnitTests -{ - using Microsoft.VisualStudio.TestTools.UnitTesting; - using SrkToolkit.DataAnnotations; - using System; - using System.Collections.Generic; - using System.ComponentModel.DataAnnotations; - using System.Linq; - using System.Text; - using System.Text.RegularExpressions; - using System.Threading.Tasks; - - [TestClass] - public class TwitterUsernameAttributeTests - { - [TestClass] - public class RegexTests - { - private Regex TwitterRegex; - - [TestInitialize] - public void Initialize() - { - this.TwitterRegex = new Regex(TwitterUsernameAttribute.TwitterRegex, RegexOptions.Compiled); - } - - [TestMethod] - public void TwitterUsernameNoMatch() - { - Assert.IsFalse(this.TwitterRegex.IsMatch("é'çà&=")); - Assert.IsFalse(this.TwitterRegex.IsMatch("user@name")); - Assert.IsFalse(this.TwitterRegex.IsMatch("usernamereallytoolong")); - } - - [TestMethod] - public void TwitterUsernameMatch() - { - Assert.IsTrue(this.TwitterRegex.IsMatch("username")); - Assert.IsTrue(this.TwitterRegex.IsMatch("user_name")); - Assert.IsTrue(this.TwitterRegex.IsMatch("@username")); - } - - [TestMethod] - public void TwitterWeirdUrlMatch() - { - Assert.IsTrue(this.TwitterRegex.IsMatch("twitter/username")); - Assert.IsTrue(this.TwitterRegex.IsMatch("twitter/@username")); - } - - [TestMethod] - public void TwitterUrlWithoutProtocolMatch() - { - Assert.IsTrue(this.TwitterRegex.IsMatch("twitter.com/username")); - Assert.IsTrue(this.TwitterRegex.IsMatch("twitter.com/@username")); - Assert.IsTrue(this.TwitterRegex.IsMatch("www.twitter.com/username")); - Assert.IsTrue(this.TwitterRegex.IsMatch("www.twitter.com/@username")); - } - - [TestMethod] - public void TwitterUrlWithProtocolMatch() - { - Assert.IsTrue(this.TwitterRegex.IsMatch("http://twitter.com/username")); - Assert.IsTrue(this.TwitterRegex.IsMatch("https://twitter.com/username")); - Assert.IsTrue(this.TwitterRegex.IsMatch("http://twitter.com/@username")); - Assert.IsTrue(this.TwitterRegex.IsMatch("https://twitter.com/@username")); - Assert.IsTrue(this.TwitterRegex.IsMatch("http://www.twitter.com/username")); - Assert.IsTrue(this.TwitterRegex.IsMatch("https://www.twitter.com/username")); - Assert.IsTrue(this.TwitterRegex.IsMatch("http://www.twitter.com/@username")); - Assert.IsTrue(this.TwitterRegex.IsMatch("https://www.twitter.com/@username")); - } - } - - [TestClass] - public class GetUsernameMethod - { - [TestMethod] - public void TwitterGetUsernameFail() - { - string username = null; - - Assert.IsFalse(TwitterUsernameAttribute.GetUsername("é'çà&=", out username)); - Assert.IsNull(username); - Assert.IsFalse(TwitterUsernameAttribute.GetUsername("user@name", out username)); - Assert.IsNull(username); - Assert.IsFalse(TwitterUsernameAttribute.GetUsername("usernamereallytoolong", out username)); - Assert.IsNull(username); - } - - [TestMethod] - public void TwitterGetUsernameSuccess() - { - string username = null; - - Assert.IsTrue(TwitterUsernameAttribute.GetUsername("username", out username)); - Assert.AreEqual("username", username); - Assert.IsTrue(TwitterUsernameAttribute.GetUsername("user_name", out username)); - Assert.AreEqual("user_name", username); - Assert.IsTrue(TwitterUsernameAttribute.GetUsername("@username", out username)); - Assert.AreEqual("username", username); - } - - [TestMethod] - public void TwitterGetUsernameFromWeirdUrl() - { - string username = null; - - Assert.IsTrue(TwitterUsernameAttribute.GetUsername("twitter/username", out username)); - Assert.AreEqual("username", username); - Assert.IsTrue(TwitterUsernameAttribute.GetUsername("twitter/@username", out username)); - Assert.AreEqual("username", username); - } - - [TestMethod] - public void TwitterGetUsernameFromUrlWithoutProtocol() - { - string username = null; - - Assert.IsTrue(TwitterUsernameAttribute.GetUsername("twitter.com/username", out username)); - Assert.AreEqual("username", username); - Assert.IsTrue(TwitterUsernameAttribute.GetUsername("twitter.com/@username", out username)); - Assert.AreEqual("username", username); - Assert.IsTrue(TwitterUsernameAttribute.GetUsername("www.twitter.com/username", out username)); - Assert.AreEqual("username", username); - Assert.IsTrue(TwitterUsernameAttribute.GetUsername("www.twitter.com/@username", out username)); - Assert.AreEqual("username", username); - } - - [TestMethod] - public void TwitterGetUsernameFromUrlWithProtocol() - { - string username = null; - - Assert.IsTrue(TwitterUsernameAttribute.GetUsername("http://twitter.com/username", out username)); - Assert.AreEqual("username", username); - Assert.IsTrue(TwitterUsernameAttribute.GetUsername("http://twitter.com/@username", out username)); - Assert.AreEqual("username", username); - Assert.IsTrue(TwitterUsernameAttribute.GetUsername("http://www.twitter.com/username", out username)); - Assert.AreEqual("username", username); - Assert.IsTrue(TwitterUsernameAttribute.GetUsername("http://www.twitter.com/@username", out username)); - Assert.AreEqual("username", username); - Assert.IsTrue(TwitterUsernameAttribute.GetUsername("https://twitter.com/username", out username)); - Assert.AreEqual("username", username); - Assert.IsTrue(TwitterUsernameAttribute.GetUsername("https://twitter.com/@username", out username)); - Assert.AreEqual("username", username); - Assert.IsTrue(TwitterUsernameAttribute.GetUsername("https://www.twitter.com/username", out username)); - Assert.AreEqual("username", username); - Assert.IsTrue(TwitterUsernameAttribute.GetUsername("https://www.twitter.com/@username", out username)); - Assert.AreEqual("username", username); - } - } - - [TestMethod] - public void ObviousInvalid() - { - var attr = new TwitterUsernameAttribute(); - string value = "foo bar", name = "Twitter"; - var context = new ValidationContext(new object(), null, null); - context.MemberName = name; - var result = attr.GetValidationResult(value, context); - Assert.IsNotNull(result); - Assert.AreEqual(@"Invalid Twitter username. You must provide the username or the url to your account.", result.ErrorMessage); - Assert.AreEqual(1, result.MemberNames.Count()); - Assert.AreEqual(name, result.MemberNames.Single()); - } - } -} diff --git a/Sources/NET4.SrkToolkit.Common.Tests/SrkDateTimeExtensionsTests.cs b/Sources/NET4.SrkToolkit.Common.Tests/SrkDateTimeExtensionsTests.cs deleted file mode 100644 index a38c113..0000000 --- a/Sources/NET4.SrkToolkit.Common.Tests/SrkDateTimeExtensionsTests.cs +++ /dev/null @@ -1,363 +0,0 @@ -// ----------------------------------------------------------------------- -// -// TODO: Update copyright text. -// -// ----------------------------------------------------------------------- - -namespace SrkToolkit.Common.Tests -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Text; - using Microsoft.VisualStudio.TestTools.UnitTesting; - - public class SrkDateTimeExtensionsTests - { - [TestClass] - public class GetDateMethod - { - [TestMethod] - public void WorksForNow() - { - var date = DateTime.Now; - - var result = date.GetDate(); - - Assert.AreEqual(date.Year, result.Year); - Assert.AreEqual(date.Month, result.Month); - Assert.AreEqual(date.Day, result.Day); - Assert.AreEqual(0, result.Hour); - Assert.AreEqual(0, result.Minute); - Assert.AreEqual(0, result.Second); - Assert.AreEqual(0, result.Millisecond); - Assert.AreEqual(date.Kind, result.Kind); - } - - [TestMethod] - public void WorksForUtcNow() - { - var date = DateTime.UtcNow; - - var result = date.GetDate(); - - Assert.AreEqual(date.Year, result.Year); - Assert.AreEqual(date.Month, result.Month); - Assert.AreEqual(date.Day, result.Day); - Assert.AreEqual(0, result.Hour); - Assert.AreEqual(0, result.Minute); - Assert.AreEqual(0, result.Second); - Assert.AreEqual(0, result.Millisecond); - Assert.AreEqual(date.Kind, result.Kind); - } - - [TestMethod] - public void Works1() - { - var date = new DateTime(1987, 6, 5, 4, 3, 2, 111, DateTimeKind.Unspecified); - - var result = date.GetDate(); - - Assert.AreEqual(date.Year, result.Year); - Assert.AreEqual(date.Month, result.Month); - Assert.AreEqual(date.Day, result.Day); - Assert.AreEqual(0, result.Hour); - Assert.AreEqual(0, result.Minute); - Assert.AreEqual(0, result.Second); - Assert.AreEqual(0, result.Millisecond); - Assert.AreEqual(date.Kind, result.Kind); - } - } - - [TestClass] - public class ToPrecisionMethod - { - [TestMethod] - public void ToMillisecond() - { - var date = new DateTime(1987, 6, 5, 4, 3, 2, 1, DateTimeKind.Utc); - var result = date.ToPrecision(DateTimePrecision.Millisecond); - - Assert.AreEqual(date.Year, result.Year); - Assert.AreEqual(date.Month, result.Month); - Assert.AreEqual(date.Day, result.Day); - Assert.AreEqual(date.Hour, result.Hour); - Assert.AreEqual(date.Minute, result.Minute); - Assert.AreEqual(date.Second, result.Second); - Assert.AreEqual(date.Millisecond, result.Millisecond); - Assert.AreEqual(date.Kind, result.Kind); - } - - [TestMethod] - public void ToSecond() - { - var date = new DateTime(1987, 6, 5, 4, 3, 2, 1, DateTimeKind.Utc); - var result = date.ToPrecision(DateTimePrecision.Second); - - Assert.AreEqual(date.Year, result.Year); - Assert.AreEqual(date.Month, result.Month); - Assert.AreEqual(date.Day, result.Day); - Assert.AreEqual(date.Hour, result.Hour); - Assert.AreEqual(date.Minute, result.Minute); - Assert.AreEqual(date.Second, result.Second); - Assert.AreEqual(0, result.Millisecond); - Assert.AreEqual(date.Kind, result.Kind); - } - - [TestMethod] - public void ToMinute() - { - var date = new DateTime(1987, 6, 5, 4, 3, 2, 1, DateTimeKind.Utc); - var result = date.ToPrecision(DateTimePrecision.Minute); - - Assert.AreEqual(date.Year, result.Year); - Assert.AreEqual(date.Month, result.Month); - Assert.AreEqual(date.Day, result.Day); - Assert.AreEqual(date.Hour, result.Hour); - Assert.AreEqual(date.Minute, result.Minute); - Assert.AreEqual(0, result.Second); - Assert.AreEqual(0, result.Millisecond); - Assert.AreEqual(date.Kind, result.Kind); - } - - [TestMethod] - public void ToHour() - { - var date = new DateTime(1987, 6, 5, 4, 3, 2, 1, DateTimeKind.Utc); - var result = date.ToPrecision(DateTimePrecision.Hour); - - Assert.AreEqual(date.Year, result.Year); - Assert.AreEqual(date.Month, result.Month); - Assert.AreEqual(date.Day, result.Day); - Assert.AreEqual(date.Hour, result.Hour); - Assert.AreEqual(0, result.Minute); - Assert.AreEqual(0, result.Second); - Assert.AreEqual(0, result.Millisecond); - Assert.AreEqual(date.Kind, result.Kind); - } - - [TestMethod] - public void ToDay() - { - var date = new DateTime(1987, 6, 5, 4, 3, 2, 1, DateTimeKind.Utc); - var result = date.ToPrecision(DateTimePrecision.Day); - - Assert.AreEqual(date.Year, result.Year); - Assert.AreEqual(date.Month, result.Month); - Assert.AreEqual(date.Day, result.Day); - Assert.AreEqual(0, result.Hour); - Assert.AreEqual(0, result.Minute); - Assert.AreEqual(0, result.Second); - Assert.AreEqual(0, result.Millisecond); - Assert.AreEqual(date.Kind, result.Kind); - } - - [TestMethod] - public void ToMonth() - { - var date = new DateTime(1987, 6, 5, 4, 3, 2, 1, DateTimeKind.Utc); - var result = date.ToPrecision(DateTimePrecision.Month); - - Assert.AreEqual(date.Year, result.Year); - Assert.AreEqual(date.Month, result.Month); - Assert.AreEqual(1, result.Day); - Assert.AreEqual(0, result.Hour); - Assert.AreEqual(0, result.Minute); - Assert.AreEqual(0, result.Second); - Assert.AreEqual(0, result.Millisecond); - Assert.AreEqual(date.Kind, result.Kind); - } - - [TestMethod] - public void ToYear() - { - var date = new DateTime(1987, 6, 5, 4, 3, 2, 1, DateTimeKind.Utc); - var result = date.ToPrecision(DateTimePrecision.Year); - - Assert.AreEqual(date.Year, result.Year); - Assert.AreEqual(1, result.Month); - Assert.AreEqual(1, result.Day); - Assert.AreEqual(0, result.Hour); - Assert.AreEqual(0, result.Minute); - Assert.AreEqual(0, result.Second); - Assert.AreEqual(0, result.Millisecond); - Assert.AreEqual(date.Kind, result.Kind); - } - } - - [TestClass] - public class IsEqualToMethod - { - [TestMethod] - public void CompareMillisecondDifference() - { - var date1 = new DateTime(1987, 6, 5, 4, 3, 2, 1, DateTimeKind.Utc); - var date2 = new DateTime(1987, 6, 5, 4, 3, 2, 2, DateTimeKind.Utc); - var result = date1.IsEqualTo(date2, DateTimePrecision.Millisecond); - Assert.IsFalse(result); - } - - [TestMethod] - public void CompareMillisecondEquality() - { - var date1 = new DateTime(1987, 6, 5, 4, 3, 2, 1, DateTimeKind.Utc); - var date2 = new DateTime(1987, 6, 5, 4, 3, 2, 1, DateTimeKind.Utc); - var result = date1.IsEqualTo(date2, DateTimePrecision.Millisecond); - Assert.IsTrue(result); - } - - [TestMethod] - public void CompareSecondDifference() - { - var date1 = new DateTime(1987, 6, 5, 4, 3, 2, 1, DateTimeKind.Utc); - var date2 = new DateTime(1987, 6, 5, 4, 3, 3, 1, DateTimeKind.Utc); - var result = date1.IsEqualTo(date2, DateTimePrecision.Second); - Assert.IsFalse(result); - } - - [TestMethod] - public void CompareSecondDifference_MsDifferent() - { - var date1 = new DateTime(1987, 6, 5, 4, 3, 2, 1, DateTimeKind.Utc); - var date2 = new DateTime(1987, 6, 5, 4, 3, 3, 2, DateTimeKind.Utc); - var result = date1.IsEqualTo(date2, DateTimePrecision.Second); - Assert.IsFalse(result); - } - - [TestMethod] - public void CompareSecondEquality() - { - var date1 = new DateTime(1987, 6, 5, 4, 3, 2, 1, DateTimeKind.Utc); - var date2 = new DateTime(1987, 6, 5, 4, 3, 2, 1, DateTimeKind.Utc); - var result = date1.IsEqualTo(date2, DateTimePrecision.Second); - Assert.IsTrue(result); - } - - [TestMethod] - public void CompareSecondEquality_MsDifferent() - { - var date1 = new DateTime(1987, 6, 5, 4, 3, 2, 1, DateTimeKind.Utc); - var date2 = new DateTime(1987, 6, 5, 4, 3, 2, 2, DateTimeKind.Utc); - var result = date1.IsEqualTo(date2, DateTimePrecision.Second); - Assert.IsTrue(result); - } - - [TestMethod] - public void CompareMinuteDifference() - { - var date1 = new DateTime(1987, 6, 5, 4, 3, 2, 1, DateTimeKind.Utc); - var date2 = new DateTime(1987, 6, 5, 4, 4, 2, 1, DateTimeKind.Utc); - var result = date1.IsEqualTo(date2, DateTimePrecision.Minute); - Assert.IsFalse(result); - } - - [TestMethod] - public void CompareMinuteDifference_SecondDifferent() - { - var date1 = new DateTime(1987, 6, 5, 4, 3, 2, 1, DateTimeKind.Utc); - var date2 = new DateTime(1987, 6, 5, 4, 4, 3, 1, DateTimeKind.Utc); - var result = date1.IsEqualTo(date2, DateTimePrecision.Minute); - Assert.IsFalse(result); - } - - [TestMethod] - public void CompareMinuteEquality() - { - var date1 = new DateTime(1987, 6, 5, 4, 3, 2, 1, DateTimeKind.Utc); - var date2 = new DateTime(1987, 6, 5, 4, 3, 2, 1, DateTimeKind.Utc); - var result = date1.IsEqualTo(date2, DateTimePrecision.Minute); - Assert.IsTrue(result); - } - - [TestMethod] - public void CompareMinuteEquality_SecondDifferent() - { - var date1 = new DateTime(1987, 6, 5, 4, 3, 2, 1, DateTimeKind.Utc); - var date2 = new DateTime(1987, 6, 5, 4, 3, 3, 2, DateTimeKind.Utc); - var result = date1.IsEqualTo(date2, DateTimePrecision.Minute); - Assert.IsTrue(result); - } - } - - [TestClass] - public class AsLocalMethod - { - [TestMethod] - public void SameValues() - { - // prepare - var date = new DateTime(1234, 5, 6, 7, 8, 9, 123, DateTimeKind.Unspecified); - var result = SrkDateTimeExtensions.AsLocal(date); - - // verify - Assert.AreEqual(date.Year, result.Year); - Assert.AreEqual(date.Month, result.Month); - Assert.AreEqual(date.Day, result.Day); - Assert.AreEqual(date.Hour, result.Hour); - Assert.AreEqual(date.Minute, result.Minute); - Assert.AreEqual(date.Second, result.Second); - Assert.AreEqual(date.Millisecond, result.Millisecond); - Assert.AreEqual(date.Ticks, result.Ticks); - Assert.AreEqual(DateTimeKind.Local, result.Kind); - } - } - - [TestClass] - public class AsUtcMethod - { - [TestMethod] - public void SameValues() - { - // prepare - var date = new DateTime(1234, 5, 6, 7, 8, 9, 123, DateTimeKind.Unspecified); - var result = SrkDateTimeExtensions.AsUtc(date); - - // verify - Assert.AreEqual(date.Year, result.Year); - Assert.AreEqual(date.Month, result.Month); - Assert.AreEqual(date.Day, result.Day); - Assert.AreEqual(date.Hour, result.Hour); - Assert.AreEqual(date.Minute, result.Minute); - Assert.AreEqual(date.Second, result.Second); - Assert.AreEqual(date.Millisecond, result.Millisecond); - Assert.AreEqual(date.Ticks, result.Ticks); - Assert.AreEqual(DateTimeKind.Utc, result.Kind); - } - } - - [TestClass] - public class AsUnspecifiedMethod - { - [TestMethod] - public void SameValues() - { - // prepare - var date = new DateTime(1234, 5, 6, 7, 8, 9, 123, DateTimeKind.Local); - var result = SrkDateTimeExtensions.AsUnspecified(date); - - // verify - Assert.AreEqual(date.Year, result.Year); - Assert.AreEqual(date.Month, result.Month); - Assert.AreEqual(date.Day, result.Day); - Assert.AreEqual(date.Hour, result.Hour); - Assert.AreEqual(date.Minute, result.Minute); - Assert.AreEqual(date.Second, result.Second); - Assert.AreEqual(date.Millisecond, result.Millisecond); - Assert.AreEqual(date.Ticks, result.Ticks); - Assert.AreEqual(DateTimeKind.Unspecified, result.Kind); - } - } - - [TestClass] - public class ToUnixTimeMethod - { - [TestMethod] - public void UtcTime() - { - DateTime time = new DateTime(2013, 1, 29, 13, 28, 21, 1, DateTimeKind.Utc); - long result = time.ToUnixTime(); - Assert.AreEqual(1359466101, result); - } - } - } -} diff --git a/Sources/NET4.SrkToolkit.Web/Modules/CrawlerGhostingModule.cs b/Sources/NET4.SrkToolkit.Web/Modules/CrawlerGhostingModule.cs deleted file mode 100644 index 2c4df2c..0000000 --- a/Sources/NET4.SrkToolkit.Web/Modules/CrawlerGhostingModule.cs +++ /dev/null @@ -1,35 +0,0 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace SrkToolkit.Web.Modules -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Text; - using System.Web; - - public class CrawlerGhostingModule : IHttpModule - { - public void Dispose() - { - } - - public void Init(HttpApplication context) - { - } - } -} diff --git a/Sources/NSTD.SrkToolkit.AspNetCore/NSTD.SrkToolkit.AspNetCore.csproj b/Sources/NSTD.SrkToolkit.AspNetCore/NSTD.SrkToolkit.AspNetCore.csproj index bd3f317..56674fd 100644 --- a/Sources/NSTD.SrkToolkit.AspNetCore/NSTD.SrkToolkit.AspNetCore.csproj +++ b/Sources/NSTD.SrkToolkit.AspNetCore/NSTD.SrkToolkit.AspNetCore.csproj @@ -1,22 +1,24 @@ - - - - netstandard2.0 - 1.2.0-beta1 - true - SrkToolkit - - - SrkToolkit.AspNetCore - - - - - - - - - - - - + + + + netstandard2.0 + 1.2.0-beta1 + true + SrkToolkit + + + SrkToolkit.AspNetCore + + + + + + + + + + + + + + diff --git a/Sources/SrkToolkit.VS15.sln b/Sources/SrkToolkit-v2.sln similarity index 65% rename from Sources/SrkToolkit.VS15.sln rename to Sources/SrkToolkit-v2.sln index b017f7f..5695f3f 100644 --- a/Sources/SrkToolkit.VS15.sln +++ b/Sources/SrkToolkit-v2.sln @@ -20,22 +20,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "30 Domain", "30 Domain", "{ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "40 Common", "40 Common", "{C3406DF1-E92C-4100-BEF9-B49F616E77C5}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "50 Web", "50 Web", "{B9ACA570-A4AC-4AC9-95E2-A95BCEDBD866}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF4.SrkToolkit.Mvvm", "WPF4.SrkToolkit.Mvvm\WPF4.SrkToolkit.Mvvm.csproj", "{A842E52E-4001-4BD8-BDCD-C95630D984D4}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF4.SrkToolkit.Xaml", "WPF4.SrkToolkit.Xaml\WPF4.SrkToolkit.Xaml.csproj", "{09A84445-2AA3-4D99-89F7-007CA3EF91A3}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "50 AspNet", "50 AspNet", "{B9ACA570-A4AC-4AC9-95E2-A95BCEDBD866}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET4.SrkToolkit.Services", "NET4.SrkToolkit.Services\NET4.SrkToolkit.Services.csproj", "{CFDFCEA2-BAFB-455E-BEF4-40343DE968CF}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET4.SrkToolkit.Services.Tests", "NET4.SrkToolkit.Services.Tests\NET4.SrkToolkit.Services.Tests.csproj", "{7E6D5FC5-4ED0-433C-A92C-D4A0C0146CCB}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET4.SrkToolkit.Mvvm.Tests", "NET4.SrkToolkit.Mvvm.Tests\NET4.SrkToolkit.Mvvm.Tests.csproj", "{9C42B357-7E5D-4192-850D-190EAEC0416A}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF45.SrkToolkit.Xaml", "WPF45.SrkToolkit.Xaml\WPF45.SrkToolkit.Xaml.csproj", "{A6D741FB-B974-491A-A2CE-DE7F491FD66D}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF45.SrkToolkit.Mvvm", "WPF45.SrkToolkit.Mvvm\WPF45.SrkToolkit.Mvvm.csproj", "{175B67BE-9042-45EE-A8DF-D96FE8B75561}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET4.SrkToolkit.Domain", "NET4.SrkToolkit.Domain\NET4.SrkToolkit.Domain.csproj", "{893A7FD4-62E6-4F7A-8FF9-EA502ADA88FA}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET4.SrkToolkit.Common", "NET4.SrkToolkit.Common\NET4.SrkToolkit.Common.csproj", "{19495A45-67A8-460D-806C-CF158B96BBE9}" @@ -62,18 +52,34 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET45.SrkToolkit.Domain.Asp EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET45.SrkToolkit.Common.Tests", "NET45.SrkToolkit.Common.Tests\NET45.SrkToolkit.Common.Tests.csproj", "{50AF7833-C345-4F6C-9FB1-36EB176D68E1}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UWP461.SrkToolkit.Mvvm", "UWP461.SrkToolkit.Mvvm\UWP461.SrkToolkit.Mvvm.csproj", "{1B365EA8-743C-4105-B86D-FF412DAD0DAF}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NSTD.SrkToolkit.Common", "NSTD.SrkToolkit.Common\NSTD.SrkToolkit.Common.csproj", "{868FFFF9-365D-4F74-881D-68577D8D2BB0}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NSTD.SrkToolkit.Web", "NSTD.SrkToolkit.Web\NSTD.SrkToolkit.Web.csproj", "{D490BE59-2AC5-4816-AF5F-1BF89F46D680}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NSTD.SrkToolkit.AspNetCore", "NSTD.SrkToolkit.AspNetCore\NSTD.SrkToolkit.AspNetCore.csproj", "{8E6E3B12-A2CB-4C2D-A871-1F2BE7FE77EA}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET45.SrkToolkit.Web.Tests", "NET4.SrkToolkit.Web.Tests\NET45.SrkToolkit.Web.Tests.csproj", "{80B716DA-2C58-4F77-8AC4-2F0180D44A39}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NSTD.SrkToolkit.Domain", "NSTD.SrkToolkit.Domain\NSTD.SrkToolkit.Domain.csproj", "{ED951C8A-9CD9-40B8-989F-E231A38EAF90}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SrkToolkit.Web.AspNetCore2", "SrkToolkit.Web.AspNetCore2\SrkToolkit.Web.AspNetCore2.csproj", "{38BDABA1-D402-45B7-ADEC-E36DC7D2E327}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SrkToolkit.AspNetCore2.UnitTests", "SrkToolkit.AspNetCore2.UnitTests\SrkToolkit.AspNetCore2.UnitTests.csproj", "{6697A04B-FCE0-479B-A11D-CACEAC2C56FC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SrkToolkit.Web.AspMvc5", "SrkToolkit.Web.AspMvc5\SrkToolkit.Web.AspMvc5.csproj", "{1C28C6A0-23B2-43ED-B62C-C586F2976473}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SrkToolkit.Common", "SrkToolkit.Common\SrkToolkit.Common.csproj", "{9442B344-FC0D-4A0B-BE0E-D317C72F2A8E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SrkToolkit.Common.FxUnitTests", "SrkToolkit.Common.FxUnitTests\SrkToolkit.Common.FxUnitTests.csproj", "{00457CE3-FE08-4AF2-972E-4C2EDD36F38D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SrkToolkit.Common.CoreUnitTests", "SrkToolkit.Common.CoreUnitTests\SrkToolkit.Common.CoreUnitTests.csproj", "{6616E666-2C77-401A-B131-6FC8E9146B23}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SrkToolkit.Domain", "SrkToolkit.Domain\SrkToolkit.Domain.csproj", "{411A61F7-37B3-493F-9C70-4DCF569311B8}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SrkToolkit.Domain.CoreUnitTests", "SrkToolkit.Domain.CoreUnitTests\SrkToolkit.Domain.CoreUnitTests.csproj", "{25B95F36-5B87-4ACD-86EC-015F32D8EAF3}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "51 AspNetCore", "51 AspNetCore", "{6CE6544E-C1DC-4EA2-BDEB-97C7E71A5C35}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SrkToolkit.Domain.AspNetCore2", "SrkToolkit.Domain.AspNetCore2\SrkToolkit.Domain.AspNetCore2.csproj", "{C1D52195-641B-4DC8-A0F9-364715A3B34A}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -86,26 +92,6 @@ Global Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {A842E52E-4001-4BD8-BDCD-C95630D984D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A842E52E-4001-4BD8-BDCD-C95630D984D4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A842E52E-4001-4BD8-BDCD-C95630D984D4}.Debug|ARM.ActiveCfg = Debug|Any CPU - {A842E52E-4001-4BD8-BDCD-C95630D984D4}.Debug|x64.ActiveCfg = Debug|Any CPU - {A842E52E-4001-4BD8-BDCD-C95630D984D4}.Debug|x86.ActiveCfg = Debug|Any CPU - {A842E52E-4001-4BD8-BDCD-C95630D984D4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A842E52E-4001-4BD8-BDCD-C95630D984D4}.Release|Any CPU.Build.0 = Release|Any CPU - {A842E52E-4001-4BD8-BDCD-C95630D984D4}.Release|ARM.ActiveCfg = Release|Any CPU - {A842E52E-4001-4BD8-BDCD-C95630D984D4}.Release|x64.ActiveCfg = Release|Any CPU - {A842E52E-4001-4BD8-BDCD-C95630D984D4}.Release|x86.ActiveCfg = Release|Any CPU - {09A84445-2AA3-4D99-89F7-007CA3EF91A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {09A84445-2AA3-4D99-89F7-007CA3EF91A3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {09A84445-2AA3-4D99-89F7-007CA3EF91A3}.Debug|ARM.ActiveCfg = Debug|Any CPU - {09A84445-2AA3-4D99-89F7-007CA3EF91A3}.Debug|x64.ActiveCfg = Debug|Any CPU - {09A84445-2AA3-4D99-89F7-007CA3EF91A3}.Debug|x86.ActiveCfg = Debug|Any CPU - {09A84445-2AA3-4D99-89F7-007CA3EF91A3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {09A84445-2AA3-4D99-89F7-007CA3EF91A3}.Release|Any CPU.Build.0 = Release|Any CPU - {09A84445-2AA3-4D99-89F7-007CA3EF91A3}.Release|ARM.ActiveCfg = Release|Any CPU - {09A84445-2AA3-4D99-89F7-007CA3EF91A3}.Release|x64.ActiveCfg = Release|Any CPU - {09A84445-2AA3-4D99-89F7-007CA3EF91A3}.Release|x86.ActiveCfg = Release|Any CPU {CFDFCEA2-BAFB-455E-BEF4-40343DE968CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CFDFCEA2-BAFB-455E-BEF4-40343DE968CF}.Debug|Any CPU.Build.0 = Debug|Any CPU {CFDFCEA2-BAFB-455E-BEF4-40343DE968CF}.Debug|ARM.ActiveCfg = Debug|Any CPU @@ -126,36 +112,6 @@ Global {7E6D5FC5-4ED0-433C-A92C-D4A0C0146CCB}.Release|ARM.ActiveCfg = Release|Any CPU {7E6D5FC5-4ED0-433C-A92C-D4A0C0146CCB}.Release|x64.ActiveCfg = Release|Any CPU {7E6D5FC5-4ED0-433C-A92C-D4A0C0146CCB}.Release|x86.ActiveCfg = Release|Any CPU - {9C42B357-7E5D-4192-850D-190EAEC0416A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9C42B357-7E5D-4192-850D-190EAEC0416A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9C42B357-7E5D-4192-850D-190EAEC0416A}.Debug|ARM.ActiveCfg = Debug|Any CPU - {9C42B357-7E5D-4192-850D-190EAEC0416A}.Debug|x64.ActiveCfg = Debug|Any CPU - {9C42B357-7E5D-4192-850D-190EAEC0416A}.Debug|x86.ActiveCfg = Debug|Any CPU - {9C42B357-7E5D-4192-850D-190EAEC0416A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9C42B357-7E5D-4192-850D-190EAEC0416A}.Release|Any CPU.Build.0 = Release|Any CPU - {9C42B357-7E5D-4192-850D-190EAEC0416A}.Release|ARM.ActiveCfg = Release|Any CPU - {9C42B357-7E5D-4192-850D-190EAEC0416A}.Release|x64.ActiveCfg = Release|Any CPU - {9C42B357-7E5D-4192-850D-190EAEC0416A}.Release|x86.ActiveCfg = Release|Any CPU - {A6D741FB-B974-491A-A2CE-DE7F491FD66D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A6D741FB-B974-491A-A2CE-DE7F491FD66D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A6D741FB-B974-491A-A2CE-DE7F491FD66D}.Debug|ARM.ActiveCfg = Debug|Any CPU - {A6D741FB-B974-491A-A2CE-DE7F491FD66D}.Debug|x64.ActiveCfg = Debug|Any CPU - {A6D741FB-B974-491A-A2CE-DE7F491FD66D}.Debug|x86.ActiveCfg = Debug|Any CPU - {A6D741FB-B974-491A-A2CE-DE7F491FD66D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A6D741FB-B974-491A-A2CE-DE7F491FD66D}.Release|Any CPU.Build.0 = Release|Any CPU - {A6D741FB-B974-491A-A2CE-DE7F491FD66D}.Release|ARM.ActiveCfg = Release|Any CPU - {A6D741FB-B974-491A-A2CE-DE7F491FD66D}.Release|x64.ActiveCfg = Release|Any CPU - {A6D741FB-B974-491A-A2CE-DE7F491FD66D}.Release|x86.ActiveCfg = Release|Any CPU - {175B67BE-9042-45EE-A8DF-D96FE8B75561}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {175B67BE-9042-45EE-A8DF-D96FE8B75561}.Debug|Any CPU.Build.0 = Debug|Any CPU - {175B67BE-9042-45EE-A8DF-D96FE8B75561}.Debug|ARM.ActiveCfg = Debug|Any CPU - {175B67BE-9042-45EE-A8DF-D96FE8B75561}.Debug|x64.ActiveCfg = Debug|Any CPU - {175B67BE-9042-45EE-A8DF-D96FE8B75561}.Debug|x86.ActiveCfg = Debug|Any CPU - {175B67BE-9042-45EE-A8DF-D96FE8B75561}.Release|Any CPU.ActiveCfg = Release|Any CPU - {175B67BE-9042-45EE-A8DF-D96FE8B75561}.Release|Any CPU.Build.0 = Release|Any CPU - {175B67BE-9042-45EE-A8DF-D96FE8B75561}.Release|ARM.ActiveCfg = Release|Any CPU - {175B67BE-9042-45EE-A8DF-D96FE8B75561}.Release|x64.ActiveCfg = Release|Any CPU - {175B67BE-9042-45EE-A8DF-D96FE8B75561}.Release|x86.ActiveCfg = Release|Any CPU {893A7FD4-62E6-4F7A-8FF9-EA502ADA88FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {893A7FD4-62E6-4F7A-8FF9-EA502ADA88FA}.Debug|Any CPU.Build.0 = Debug|Any CPU {893A7FD4-62E6-4F7A-8FF9-EA502ADA88FA}.Debug|ARM.ActiveCfg = Debug|Any CPU @@ -286,16 +242,6 @@ Global {50AF7833-C345-4F6C-9FB1-36EB176D68E1}.Release|ARM.ActiveCfg = Release|Any CPU {50AF7833-C345-4F6C-9FB1-36EB176D68E1}.Release|x64.ActiveCfg = Release|Any CPU {50AF7833-C345-4F6C-9FB1-36EB176D68E1}.Release|x86.ActiveCfg = Release|Any CPU - {1B365EA8-743C-4105-B86D-FF412DAD0DAF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1B365EA8-743C-4105-B86D-FF412DAD0DAF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1B365EA8-743C-4105-B86D-FF412DAD0DAF}.Debug|ARM.ActiveCfg = Debug|Any CPU - {1B365EA8-743C-4105-B86D-FF412DAD0DAF}.Debug|x64.ActiveCfg = Debug|Any CPU - {1B365EA8-743C-4105-B86D-FF412DAD0DAF}.Debug|x86.ActiveCfg = Debug|Any CPU - {1B365EA8-743C-4105-B86D-FF412DAD0DAF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1B365EA8-743C-4105-B86D-FF412DAD0DAF}.Release|Any CPU.Build.0 = Release|Any CPU - {1B365EA8-743C-4105-B86D-FF412DAD0DAF}.Release|ARM.ActiveCfg = Release|Any CPU - {1B365EA8-743C-4105-B86D-FF412DAD0DAF}.Release|x64.ActiveCfg = Release|Any CPU - {1B365EA8-743C-4105-B86D-FF412DAD0DAF}.Release|x86.ActiveCfg = Release|Any CPU {868FFFF9-365D-4F74-881D-68577D8D2BB0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {868FFFF9-365D-4F74-881D-68577D8D2BB0}.Debug|Any CPU.Build.0 = Debug|Any CPU {868FFFF9-365D-4F74-881D-68577D8D2BB0}.Debug|ARM.ActiveCfg = Debug|Any CPU @@ -328,22 +274,6 @@ Global {D490BE59-2AC5-4816-AF5F-1BF89F46D680}.Release|x64.Build.0 = Release|Any CPU {D490BE59-2AC5-4816-AF5F-1BF89F46D680}.Release|x86.ActiveCfg = Release|Any CPU {D490BE59-2AC5-4816-AF5F-1BF89F46D680}.Release|x86.Build.0 = Release|Any CPU - {8E6E3B12-A2CB-4C2D-A871-1F2BE7FE77EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8E6E3B12-A2CB-4C2D-A871-1F2BE7FE77EA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8E6E3B12-A2CB-4C2D-A871-1F2BE7FE77EA}.Debug|ARM.ActiveCfg = Debug|Any CPU - {8E6E3B12-A2CB-4C2D-A871-1F2BE7FE77EA}.Debug|ARM.Build.0 = Debug|Any CPU - {8E6E3B12-A2CB-4C2D-A871-1F2BE7FE77EA}.Debug|x64.ActiveCfg = Debug|Any CPU - {8E6E3B12-A2CB-4C2D-A871-1F2BE7FE77EA}.Debug|x64.Build.0 = Debug|Any CPU - {8E6E3B12-A2CB-4C2D-A871-1F2BE7FE77EA}.Debug|x86.ActiveCfg = Debug|Any CPU - {8E6E3B12-A2CB-4C2D-A871-1F2BE7FE77EA}.Debug|x86.Build.0 = Debug|Any CPU - {8E6E3B12-A2CB-4C2D-A871-1F2BE7FE77EA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8E6E3B12-A2CB-4C2D-A871-1F2BE7FE77EA}.Release|Any CPU.Build.0 = Release|Any CPU - {8E6E3B12-A2CB-4C2D-A871-1F2BE7FE77EA}.Release|ARM.ActiveCfg = Release|Any CPU - {8E6E3B12-A2CB-4C2D-A871-1F2BE7FE77EA}.Release|ARM.Build.0 = Release|Any CPU - {8E6E3B12-A2CB-4C2D-A871-1F2BE7FE77EA}.Release|x64.ActiveCfg = Release|Any CPU - {8E6E3B12-A2CB-4C2D-A871-1F2BE7FE77EA}.Release|x64.Build.0 = Release|Any CPU - {8E6E3B12-A2CB-4C2D-A871-1F2BE7FE77EA}.Release|x86.ActiveCfg = Release|Any CPU - {8E6E3B12-A2CB-4C2D-A871-1F2BE7FE77EA}.Release|x86.Build.0 = Release|Any CPU {80B716DA-2C58-4F77-8AC4-2F0180D44A39}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {80B716DA-2C58-4F77-8AC4-2F0180D44A39}.Debug|Any CPU.Build.0 = Debug|Any CPU {80B716DA-2C58-4F77-8AC4-2F0180D44A39}.Debug|ARM.ActiveCfg = Debug|Any CPU @@ -376,18 +306,157 @@ Global {ED951C8A-9CD9-40B8-989F-E231A38EAF90}.Release|x64.Build.0 = Release|Any CPU {ED951C8A-9CD9-40B8-989F-E231A38EAF90}.Release|x86.ActiveCfg = Release|Any CPU {ED951C8A-9CD9-40B8-989F-E231A38EAF90}.Release|x86.Build.0 = Release|Any CPU + {38BDABA1-D402-45B7-ADEC-E36DC7D2E327}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {38BDABA1-D402-45B7-ADEC-E36DC7D2E327}.Debug|Any CPU.Build.0 = Debug|Any CPU + {38BDABA1-D402-45B7-ADEC-E36DC7D2E327}.Debug|ARM.ActiveCfg = Debug|Any CPU + {38BDABA1-D402-45B7-ADEC-E36DC7D2E327}.Debug|ARM.Build.0 = Debug|Any CPU + {38BDABA1-D402-45B7-ADEC-E36DC7D2E327}.Debug|x64.ActiveCfg = Debug|Any CPU + {38BDABA1-D402-45B7-ADEC-E36DC7D2E327}.Debug|x64.Build.0 = Debug|Any CPU + {38BDABA1-D402-45B7-ADEC-E36DC7D2E327}.Debug|x86.ActiveCfg = Debug|Any CPU + {38BDABA1-D402-45B7-ADEC-E36DC7D2E327}.Debug|x86.Build.0 = Debug|Any CPU + {38BDABA1-D402-45B7-ADEC-E36DC7D2E327}.Release|Any CPU.ActiveCfg = Release|Any CPU + {38BDABA1-D402-45B7-ADEC-E36DC7D2E327}.Release|Any CPU.Build.0 = Release|Any CPU + {38BDABA1-D402-45B7-ADEC-E36DC7D2E327}.Release|ARM.ActiveCfg = Release|Any CPU + {38BDABA1-D402-45B7-ADEC-E36DC7D2E327}.Release|ARM.Build.0 = Release|Any CPU + {38BDABA1-D402-45B7-ADEC-E36DC7D2E327}.Release|x64.ActiveCfg = Release|Any CPU + {38BDABA1-D402-45B7-ADEC-E36DC7D2E327}.Release|x64.Build.0 = Release|Any CPU + {38BDABA1-D402-45B7-ADEC-E36DC7D2E327}.Release|x86.ActiveCfg = Release|Any CPU + {38BDABA1-D402-45B7-ADEC-E36DC7D2E327}.Release|x86.Build.0 = Release|Any CPU + {6697A04B-FCE0-479B-A11D-CACEAC2C56FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6697A04B-FCE0-479B-A11D-CACEAC2C56FC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6697A04B-FCE0-479B-A11D-CACEAC2C56FC}.Debug|ARM.ActiveCfg = Debug|Any CPU + {6697A04B-FCE0-479B-A11D-CACEAC2C56FC}.Debug|ARM.Build.0 = Debug|Any CPU + {6697A04B-FCE0-479B-A11D-CACEAC2C56FC}.Debug|x64.ActiveCfg = Debug|Any CPU + {6697A04B-FCE0-479B-A11D-CACEAC2C56FC}.Debug|x64.Build.0 = Debug|Any CPU + {6697A04B-FCE0-479B-A11D-CACEAC2C56FC}.Debug|x86.ActiveCfg = Debug|Any CPU + {6697A04B-FCE0-479B-A11D-CACEAC2C56FC}.Debug|x86.Build.0 = Debug|Any CPU + {6697A04B-FCE0-479B-A11D-CACEAC2C56FC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6697A04B-FCE0-479B-A11D-CACEAC2C56FC}.Release|Any CPU.Build.0 = Release|Any CPU + {6697A04B-FCE0-479B-A11D-CACEAC2C56FC}.Release|ARM.ActiveCfg = Release|Any CPU + {6697A04B-FCE0-479B-A11D-CACEAC2C56FC}.Release|ARM.Build.0 = Release|Any CPU + {6697A04B-FCE0-479B-A11D-CACEAC2C56FC}.Release|x64.ActiveCfg = Release|Any CPU + {6697A04B-FCE0-479B-A11D-CACEAC2C56FC}.Release|x64.Build.0 = Release|Any CPU + {6697A04B-FCE0-479B-A11D-CACEAC2C56FC}.Release|x86.ActiveCfg = Release|Any CPU + {6697A04B-FCE0-479B-A11D-CACEAC2C56FC}.Release|x86.Build.0 = Release|Any CPU + {1C28C6A0-23B2-43ED-B62C-C586F2976473}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1C28C6A0-23B2-43ED-B62C-C586F2976473}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1C28C6A0-23B2-43ED-B62C-C586F2976473}.Debug|ARM.ActiveCfg = Debug|Any CPU + {1C28C6A0-23B2-43ED-B62C-C586F2976473}.Debug|ARM.Build.0 = Debug|Any CPU + {1C28C6A0-23B2-43ED-B62C-C586F2976473}.Debug|x64.ActiveCfg = Debug|Any CPU + {1C28C6A0-23B2-43ED-B62C-C586F2976473}.Debug|x64.Build.0 = Debug|Any CPU + {1C28C6A0-23B2-43ED-B62C-C586F2976473}.Debug|x86.ActiveCfg = Debug|Any CPU + {1C28C6A0-23B2-43ED-B62C-C586F2976473}.Debug|x86.Build.0 = Debug|Any CPU + {1C28C6A0-23B2-43ED-B62C-C586F2976473}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1C28C6A0-23B2-43ED-B62C-C586F2976473}.Release|Any CPU.Build.0 = Release|Any CPU + {1C28C6A0-23B2-43ED-B62C-C586F2976473}.Release|ARM.ActiveCfg = Release|Any CPU + {1C28C6A0-23B2-43ED-B62C-C586F2976473}.Release|ARM.Build.0 = Release|Any CPU + {1C28C6A0-23B2-43ED-B62C-C586F2976473}.Release|x64.ActiveCfg = Release|Any CPU + {1C28C6A0-23B2-43ED-B62C-C586F2976473}.Release|x64.Build.0 = Release|Any CPU + {1C28C6A0-23B2-43ED-B62C-C586F2976473}.Release|x86.ActiveCfg = Release|Any CPU + {1C28C6A0-23B2-43ED-B62C-C586F2976473}.Release|x86.Build.0 = Release|Any CPU + {9442B344-FC0D-4A0B-BE0E-D317C72F2A8E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9442B344-FC0D-4A0B-BE0E-D317C72F2A8E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9442B344-FC0D-4A0B-BE0E-D317C72F2A8E}.Debug|ARM.ActiveCfg = Debug|Any CPU + {9442B344-FC0D-4A0B-BE0E-D317C72F2A8E}.Debug|ARM.Build.0 = Debug|Any CPU + {9442B344-FC0D-4A0B-BE0E-D317C72F2A8E}.Debug|x64.ActiveCfg = Debug|Any CPU + {9442B344-FC0D-4A0B-BE0E-D317C72F2A8E}.Debug|x64.Build.0 = Debug|Any CPU + {9442B344-FC0D-4A0B-BE0E-D317C72F2A8E}.Debug|x86.ActiveCfg = Debug|Any CPU + {9442B344-FC0D-4A0B-BE0E-D317C72F2A8E}.Debug|x86.Build.0 = Debug|Any CPU + {9442B344-FC0D-4A0B-BE0E-D317C72F2A8E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9442B344-FC0D-4A0B-BE0E-D317C72F2A8E}.Release|Any CPU.Build.0 = Release|Any CPU + {9442B344-FC0D-4A0B-BE0E-D317C72F2A8E}.Release|ARM.ActiveCfg = Release|Any CPU + {9442B344-FC0D-4A0B-BE0E-D317C72F2A8E}.Release|ARM.Build.0 = Release|Any CPU + {9442B344-FC0D-4A0B-BE0E-D317C72F2A8E}.Release|x64.ActiveCfg = Release|Any CPU + {9442B344-FC0D-4A0B-BE0E-D317C72F2A8E}.Release|x64.Build.0 = Release|Any CPU + {9442B344-FC0D-4A0B-BE0E-D317C72F2A8E}.Release|x86.ActiveCfg = Release|Any CPU + {9442B344-FC0D-4A0B-BE0E-D317C72F2A8E}.Release|x86.Build.0 = Release|Any CPU + {00457CE3-FE08-4AF2-972E-4C2EDD36F38D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {00457CE3-FE08-4AF2-972E-4C2EDD36F38D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {00457CE3-FE08-4AF2-972E-4C2EDD36F38D}.Debug|ARM.ActiveCfg = Debug|Any CPU + {00457CE3-FE08-4AF2-972E-4C2EDD36F38D}.Debug|ARM.Build.0 = Debug|Any CPU + {00457CE3-FE08-4AF2-972E-4C2EDD36F38D}.Debug|x64.ActiveCfg = Debug|Any CPU + {00457CE3-FE08-4AF2-972E-4C2EDD36F38D}.Debug|x64.Build.0 = Debug|Any CPU + {00457CE3-FE08-4AF2-972E-4C2EDD36F38D}.Debug|x86.ActiveCfg = Debug|Any CPU + {00457CE3-FE08-4AF2-972E-4C2EDD36F38D}.Debug|x86.Build.0 = Debug|Any CPU + {00457CE3-FE08-4AF2-972E-4C2EDD36F38D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {00457CE3-FE08-4AF2-972E-4C2EDD36F38D}.Release|Any CPU.Build.0 = Release|Any CPU + {00457CE3-FE08-4AF2-972E-4C2EDD36F38D}.Release|ARM.ActiveCfg = Release|Any CPU + {00457CE3-FE08-4AF2-972E-4C2EDD36F38D}.Release|ARM.Build.0 = Release|Any CPU + {00457CE3-FE08-4AF2-972E-4C2EDD36F38D}.Release|x64.ActiveCfg = Release|Any CPU + {00457CE3-FE08-4AF2-972E-4C2EDD36F38D}.Release|x64.Build.0 = Release|Any CPU + {00457CE3-FE08-4AF2-972E-4C2EDD36F38D}.Release|x86.ActiveCfg = Release|Any CPU + {00457CE3-FE08-4AF2-972E-4C2EDD36F38D}.Release|x86.Build.0 = Release|Any CPU + {6616E666-2C77-401A-B131-6FC8E9146B23}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6616E666-2C77-401A-B131-6FC8E9146B23}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6616E666-2C77-401A-B131-6FC8E9146B23}.Debug|ARM.ActiveCfg = Debug|Any CPU + {6616E666-2C77-401A-B131-6FC8E9146B23}.Debug|ARM.Build.0 = Debug|Any CPU + {6616E666-2C77-401A-B131-6FC8E9146B23}.Debug|x64.ActiveCfg = Debug|Any CPU + {6616E666-2C77-401A-B131-6FC8E9146B23}.Debug|x64.Build.0 = Debug|Any CPU + {6616E666-2C77-401A-B131-6FC8E9146B23}.Debug|x86.ActiveCfg = Debug|Any CPU + {6616E666-2C77-401A-B131-6FC8E9146B23}.Debug|x86.Build.0 = Debug|Any CPU + {6616E666-2C77-401A-B131-6FC8E9146B23}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6616E666-2C77-401A-B131-6FC8E9146B23}.Release|Any CPU.Build.0 = Release|Any CPU + {6616E666-2C77-401A-B131-6FC8E9146B23}.Release|ARM.ActiveCfg = Release|Any CPU + {6616E666-2C77-401A-B131-6FC8E9146B23}.Release|ARM.Build.0 = Release|Any CPU + {6616E666-2C77-401A-B131-6FC8E9146B23}.Release|x64.ActiveCfg = Release|Any CPU + {6616E666-2C77-401A-B131-6FC8E9146B23}.Release|x64.Build.0 = Release|Any CPU + {6616E666-2C77-401A-B131-6FC8E9146B23}.Release|x86.ActiveCfg = Release|Any CPU + {6616E666-2C77-401A-B131-6FC8E9146B23}.Release|x86.Build.0 = Release|Any CPU + {411A61F7-37B3-493F-9C70-4DCF569311B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {411A61F7-37B3-493F-9C70-4DCF569311B8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {411A61F7-37B3-493F-9C70-4DCF569311B8}.Debug|ARM.ActiveCfg = Debug|Any CPU + {411A61F7-37B3-493F-9C70-4DCF569311B8}.Debug|ARM.Build.0 = Debug|Any CPU + {411A61F7-37B3-493F-9C70-4DCF569311B8}.Debug|x64.ActiveCfg = Debug|Any CPU + {411A61F7-37B3-493F-9C70-4DCF569311B8}.Debug|x64.Build.0 = Debug|Any CPU + {411A61F7-37B3-493F-9C70-4DCF569311B8}.Debug|x86.ActiveCfg = Debug|Any CPU + {411A61F7-37B3-493F-9C70-4DCF569311B8}.Debug|x86.Build.0 = Debug|Any CPU + {411A61F7-37B3-493F-9C70-4DCF569311B8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {411A61F7-37B3-493F-9C70-4DCF569311B8}.Release|Any CPU.Build.0 = Release|Any CPU + {411A61F7-37B3-493F-9C70-4DCF569311B8}.Release|ARM.ActiveCfg = Release|Any CPU + {411A61F7-37B3-493F-9C70-4DCF569311B8}.Release|ARM.Build.0 = Release|Any CPU + {411A61F7-37B3-493F-9C70-4DCF569311B8}.Release|x64.ActiveCfg = Release|Any CPU + {411A61F7-37B3-493F-9C70-4DCF569311B8}.Release|x64.Build.0 = Release|Any CPU + {411A61F7-37B3-493F-9C70-4DCF569311B8}.Release|x86.ActiveCfg = Release|Any CPU + {411A61F7-37B3-493F-9C70-4DCF569311B8}.Release|x86.Build.0 = Release|Any CPU + {25B95F36-5B87-4ACD-86EC-015F32D8EAF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {25B95F36-5B87-4ACD-86EC-015F32D8EAF3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {25B95F36-5B87-4ACD-86EC-015F32D8EAF3}.Debug|ARM.ActiveCfg = Debug|Any CPU + {25B95F36-5B87-4ACD-86EC-015F32D8EAF3}.Debug|ARM.Build.0 = Debug|Any CPU + {25B95F36-5B87-4ACD-86EC-015F32D8EAF3}.Debug|x64.ActiveCfg = Debug|Any CPU + {25B95F36-5B87-4ACD-86EC-015F32D8EAF3}.Debug|x64.Build.0 = Debug|Any CPU + {25B95F36-5B87-4ACD-86EC-015F32D8EAF3}.Debug|x86.ActiveCfg = Debug|Any CPU + {25B95F36-5B87-4ACD-86EC-015F32D8EAF3}.Debug|x86.Build.0 = Debug|Any CPU + {25B95F36-5B87-4ACD-86EC-015F32D8EAF3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {25B95F36-5B87-4ACD-86EC-015F32D8EAF3}.Release|Any CPU.Build.0 = Release|Any CPU + {25B95F36-5B87-4ACD-86EC-015F32D8EAF3}.Release|ARM.ActiveCfg = Release|Any CPU + {25B95F36-5B87-4ACD-86EC-015F32D8EAF3}.Release|ARM.Build.0 = Release|Any CPU + {25B95F36-5B87-4ACD-86EC-015F32D8EAF3}.Release|x64.ActiveCfg = Release|Any CPU + {25B95F36-5B87-4ACD-86EC-015F32D8EAF3}.Release|x64.Build.0 = Release|Any CPU + {25B95F36-5B87-4ACD-86EC-015F32D8EAF3}.Release|x86.ActiveCfg = Release|Any CPU + {25B95F36-5B87-4ACD-86EC-015F32D8EAF3}.Release|x86.Build.0 = Release|Any CPU + {C1D52195-641B-4DC8-A0F9-364715A3B34A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C1D52195-641B-4DC8-A0F9-364715A3B34A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C1D52195-641B-4DC8-A0F9-364715A3B34A}.Debug|ARM.ActiveCfg = Debug|Any CPU + {C1D52195-641B-4DC8-A0F9-364715A3B34A}.Debug|ARM.Build.0 = Debug|Any CPU + {C1D52195-641B-4DC8-A0F9-364715A3B34A}.Debug|x64.ActiveCfg = Debug|Any CPU + {C1D52195-641B-4DC8-A0F9-364715A3B34A}.Debug|x64.Build.0 = Debug|Any CPU + {C1D52195-641B-4DC8-A0F9-364715A3B34A}.Debug|x86.ActiveCfg = Debug|Any CPU + {C1D52195-641B-4DC8-A0F9-364715A3B34A}.Debug|x86.Build.0 = Debug|Any CPU + {C1D52195-641B-4DC8-A0F9-364715A3B34A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C1D52195-641B-4DC8-A0F9-364715A3B34A}.Release|Any CPU.Build.0 = Release|Any CPU + {C1D52195-641B-4DC8-A0F9-364715A3B34A}.Release|ARM.ActiveCfg = Release|Any CPU + {C1D52195-641B-4DC8-A0F9-364715A3B34A}.Release|ARM.Build.0 = Release|Any CPU + {C1D52195-641B-4DC8-A0F9-364715A3B34A}.Release|x64.ActiveCfg = Release|Any CPU + {C1D52195-641B-4DC8-A0F9-364715A3B34A}.Release|x64.Build.0 = Release|Any CPU + {C1D52195-641B-4DC8-A0F9-364715A3B34A}.Release|x86.ActiveCfg = Release|Any CPU + {C1D52195-641B-4DC8-A0F9-364715A3B34A}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {A842E52E-4001-4BD8-BDCD-C95630D984D4} = {D6B06B88-8371-4360-B47E-8A772B92323A} - {09A84445-2AA3-4D99-89F7-007CA3EF91A3} = {A3324369-1E2D-495C-8E96-109B6F98F003} {CFDFCEA2-BAFB-455E-BEF4-40343DE968CF} = {B70211DF-4DB4-4D29-842C-1CE527BD1EFC} {7E6D5FC5-4ED0-433C-A92C-D4A0C0146CCB} = {B70211DF-4DB4-4D29-842C-1CE527BD1EFC} - {9C42B357-7E5D-4192-850D-190EAEC0416A} = {D6B06B88-8371-4360-B47E-8A772B92323A} - {A6D741FB-B974-491A-A2CE-DE7F491FD66D} = {A3324369-1E2D-495C-8E96-109B6F98F003} - {175B67BE-9042-45EE-A8DF-D96FE8B75561} = {D6B06B88-8371-4360-B47E-8A772B92323A} {893A7FD4-62E6-4F7A-8FF9-EA502ADA88FA} = {559DC157-DDC9-44BA-B25D-0A18E286D1CC} {19495A45-67A8-460D-806C-CF158B96BBE9} = {C3406DF1-E92C-4100-BEF9-B49F616E77C5} {19727F77-249A-4AC9-859C-8441E5BD41C4} = {C3406DF1-E92C-4100-BEF9-B49F616E77C5} @@ -401,12 +470,19 @@ Global {55341205-ACB8-4E7D-8E39-0629AA8C2C32} = {B9ACA570-A4AC-4AC9-95E2-A95BCEDBD866} {F354D8B6-F293-45ED-AF9B-B746E1232C17} = {559DC157-DDC9-44BA-B25D-0A18E286D1CC} {50AF7833-C345-4F6C-9FB1-36EB176D68E1} = {C3406DF1-E92C-4100-BEF9-B49F616E77C5} - {1B365EA8-743C-4105-B86D-FF412DAD0DAF} = {D6B06B88-8371-4360-B47E-8A772B92323A} {868FFFF9-365D-4F74-881D-68577D8D2BB0} = {C3406DF1-E92C-4100-BEF9-B49F616E77C5} {D490BE59-2AC5-4816-AF5F-1BF89F46D680} = {B9ACA570-A4AC-4AC9-95E2-A95BCEDBD866} - {8E6E3B12-A2CB-4C2D-A871-1F2BE7FE77EA} = {B9ACA570-A4AC-4AC9-95E2-A95BCEDBD866} {80B716DA-2C58-4F77-8AC4-2F0180D44A39} = {B9ACA570-A4AC-4AC9-95E2-A95BCEDBD866} {ED951C8A-9CD9-40B8-989F-E231A38EAF90} = {559DC157-DDC9-44BA-B25D-0A18E286D1CC} + {1C28C6A0-23B2-43ED-B62C-C586F2976473} = {B9ACA570-A4AC-4AC9-95E2-A95BCEDBD866} + {9442B344-FC0D-4A0B-BE0E-D317C72F2A8E} = {C3406DF1-E92C-4100-BEF9-B49F616E77C5} + {00457CE3-FE08-4AF2-972E-4C2EDD36F38D} = {C3406DF1-E92C-4100-BEF9-B49F616E77C5} + {6616E666-2C77-401A-B131-6FC8E9146B23} = {C3406DF1-E92C-4100-BEF9-B49F616E77C5} + {411A61F7-37B3-493F-9C70-4DCF569311B8} = {559DC157-DDC9-44BA-B25D-0A18E286D1CC} + {25B95F36-5B87-4ACD-86EC-015F32D8EAF3} = {559DC157-DDC9-44BA-B25D-0A18E286D1CC} + {38BDABA1-D402-45B7-ADEC-E36DC7D2E327} = {6CE6544E-C1DC-4EA2-BDEB-97C7E71A5C35} + {6697A04B-FCE0-479B-A11D-CACEAC2C56FC} = {6CE6544E-C1DC-4EA2-BDEB-97C7E71A5C35} + {C1D52195-641B-4DC8-A0F9-364715A3B34A} = {6CE6544E-C1DC-4EA2-BDEB-97C7E71A5C35} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {2EE63A79-DD96-484C-9FBF-348067F95F0F} diff --git a/Sources/NET4.SrkToolkit.Web.Tests/ChangeCurrentCulture.cs b/Sources/SrkToolkit.AspNetCore2.UnitTests/ChangeCurrentCulture.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Web.Tests/ChangeCurrentCulture.cs rename to Sources/SrkToolkit.AspNetCore2.UnitTests/ChangeCurrentCulture.cs diff --git a/Sources/NET4.SrkToolkit.Web.Tests/DecimalModelBinderTests.cs b/Sources/SrkToolkit.AspNetCore2.UnitTests/DecimalModelBinderTests.cs similarity index 94% rename from Sources/NET4.SrkToolkit.Web.Tests/DecimalModelBinderTests.cs rename to Sources/SrkToolkit.AspNetCore2.UnitTests/DecimalModelBinderTests.cs index d1652c1..0661b0f 100644 --- a/Sources/NET4.SrkToolkit.Web.Tests/DecimalModelBinderTests.cs +++ b/Sources/SrkToolkit.AspNetCore2.UnitTests/DecimalModelBinderTests.cs @@ -20,14 +20,12 @@ namespace SrkToolkit.Web.Tests using System.Collections.Generic; using System.Linq; using System.Text; - using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Globalization; using SrkToolkit.Web.Mvc; - using System.Web.Mvc; + using Xunit; public class DecimalModelBinderTests { - [TestClass] public class ConvertFrenchStyleDecimals { static List> doubleExpectations; @@ -81,7 +79,7 @@ public static CultureInfo C(string name) return new CultureInfo(name); } - [TestMethod] + [Fact] public void DoubleNotFrenchStyle() { var target = new DecimalModelBinder(); @@ -94,7 +92,7 @@ public void DoubleNotFrenchStyle() } } - [TestMethod] + [Fact] public void DoubleIsFrenchStyle() { var target = new DecimalModelBinder(); @@ -107,7 +105,7 @@ public void DoubleIsFrenchStyle() } } - [TestMethod] + [Fact] public void DoubleBug1() { // typical bug we don't want to see @@ -123,7 +121,7 @@ public void DoubleBug1() Assert.AreEqual(0, result.Errors.Count); } - [TestMethod] + [Fact] public void DoubleNotNullable() { // typical bug we don't want to see @@ -138,7 +136,7 @@ public void DoubleNotNullable() Assert.AreEqual(1, result.Errors.Count); } - [TestMethod] + [Fact] public void DoubleIsNullable() { // typical bug we don't want to see @@ -154,7 +152,7 @@ public void DoubleIsNullable() Assert.AreEqual(0, result.Errors.Count); } - [TestMethod] + [Fact] public void DecimalNotFrenchStyle() { var target = new DecimalModelBinder(); @@ -168,7 +166,7 @@ public void DecimalNotFrenchStyle() } } - [TestMethod] + [Fact] public void DecimalIsFrenchStyle() { var target = new DecimalModelBinder(); @@ -182,7 +180,7 @@ public void DecimalIsFrenchStyle() } } - [TestMethod] + [Fact] public void DecimalBug1() { // typical bug we don't want to see @@ -198,7 +196,7 @@ public void DecimalBug1() Assert.AreEqual(0, result.Errors.Count); } - [TestMethod] + [Fact] public void DecimalNotNullable() { // typical bug we don't want to see @@ -213,7 +211,7 @@ public void DecimalNotNullable() Assert.AreEqual(1, result.Errors.Count); } - [TestMethod] + [Fact] public void DecimalIsNullable() { // typical bug we don't want to see @@ -229,7 +227,7 @@ public void DecimalIsNullable() Assert.AreEqual(0, result.Errors.Count); } - [TestMethod] + [Fact] public void DecimalIsNullableNull() { // typical bug we don't want to see @@ -245,7 +243,7 @@ public void DecimalIsNullableNull() Assert.AreEqual(0, result.Errors.Count); } - [TestMethod] + [Fact] public void Bug1() { string input = "123.45"; @@ -261,10 +259,9 @@ public void Bug1() } } - [TestClass] public class RegisterMethod { - [TestMethod] + [Fact] public void Works() { var binders = new ModelBinderDictionary(); diff --git a/Sources/NET4.SrkToolkit.Web.Tests/IntegerModelBinderTests.cs b/Sources/SrkToolkit.AspNetCore2.UnitTests/IntegerModelBinderTests.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Web.Tests/IntegerModelBinderTests.cs rename to Sources/SrkToolkit.AspNetCore2.UnitTests/IntegerModelBinderTests.cs diff --git a/Sources/NET4.SrkToolkit.Web.Tests/OpenGraphNameTests.cs b/Sources/SrkToolkit.AspNetCore2.UnitTests/OpenGraphNameTests.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Web.Tests/OpenGraphNameTests.cs rename to Sources/SrkToolkit.AspNetCore2.UnitTests/OpenGraphNameTests.cs diff --git a/Sources/NET4.SrkToolkit.Web.Tests/OpenGraphNamespaceTests.cs b/Sources/SrkToolkit.AspNetCore2.UnitTests/OpenGraphNamespaceTests.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Web.Tests/OpenGraphNamespaceTests.cs rename to Sources/SrkToolkit.AspNetCore2.UnitTests/OpenGraphNamespaceTests.cs diff --git a/Sources/NET4.SrkToolkit.Web.Tests/OpenGraphObjectTests.cs b/Sources/SrkToolkit.AspNetCore2.UnitTests/OpenGraphObjectTests.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Web.Tests/OpenGraphObjectTests.cs rename to Sources/SrkToolkit.AspNetCore2.UnitTests/OpenGraphObjectTests.cs diff --git a/Sources/NET4.SrkToolkit.Web.Tests/OpenGraphTagTests.cs b/Sources/SrkToolkit.AspNetCore2.UnitTests/OpenGraphTagTests.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Web.Tests/OpenGraphTagTests.cs rename to Sources/SrkToolkit.AspNetCore2.UnitTests/OpenGraphTagTests.cs diff --git a/Sources/NET4.SrkToolkit.Web.Tests/PageInfoTests.cs b/Sources/SrkToolkit.AspNetCore2.UnitTests/PageInfoTests.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Web.Tests/PageInfoTests.cs rename to Sources/SrkToolkit.AspNetCore2.UnitTests/PageInfoTests.cs diff --git a/Sources/NET4.SrkToolkit.Web.Tests/SrkHtmlExtensionsTests.cs b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkHtmlExtensionsTests.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Web.Tests/SrkHtmlExtensionsTests.cs rename to Sources/SrkToolkit.AspNetCore2.UnitTests/SrkHtmlExtensionsTests.cs diff --git a/Sources/NET4.SrkToolkit.Web.Tests/SrkHttpContextExtensionsTests.cs b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkHttpContextExtensionsTests.cs similarity index 97% rename from Sources/NET4.SrkToolkit.Web.Tests/SrkHttpContextExtensionsTests.cs rename to Sources/SrkToolkit.AspNetCore2.UnitTests/SrkHttpContextExtensionsTests.cs index b13113b..a323d78 100644 --- a/Sources/NET4.SrkToolkit.Web.Tests/SrkHttpContextExtensionsTests.cs +++ b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkHttpContextExtensionsTests.cs @@ -1,92 +1,92 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace SrkToolkit.Web.Tests -{ - using Microsoft.VisualStudio.TestTools.UnitTesting; - using SrkToolkit.Web.Fakes; - using System; - using System.Collections.Generic; - using System.Linq; - - [TestClass] - public class SrkHttpContextExtensionsTests - { - [TestClass] - public class SetTimezoneMethod - { - [TestMethod] - public void WorksWithTzObject() - { - var tz = TimeZoneInfo.FindSystemTimeZoneById("Romance Standard Time"); - var http = new BasicHttpContext(); - SrkHttpContextExtensions.SetTimezone(http, tz); - - Assert.IsNotNull(http.Items["Timezone"]); - Assert.AreEqual(tz, http.Items["Timezone"]); - } - - [TestMethod] - public void WorksWithTzName() - { - var tzName = "Romance Standard Time"; - var tz = TimeZoneInfo.FindSystemTimeZoneById(tzName); - var http = new BasicHttpContext(); - SrkHttpContextExtensions.SetTimezone(http, tzName); - - Assert.IsNotNull(http.Items["Timezone"]); - Assert.AreEqual(tz, http.Items["Timezone"]); - } - - [TestMethod, ExpectedException(typeof(ArgumentException))] - public void NullTzName() - { - string tzName = null; - var http = new BasicHttpContext(); - SrkHttpContextExtensions.SetTimezone(http, tzName); - } - - [TestMethod, ExpectedException(typeof(ArgumentException))] - public void EmptyTzName() - { - string tzName = string.Empty; - var http = new BasicHttpContext(); - SrkHttpContextExtensions.SetTimezone(http, tzName); - } - - [TestMethod, ExpectedException(typeof(TimeZoneNotFoundException))] - public void InvalidTzName() - { - string tzName = "Lunar Standard Time"; - var http = new BasicHttpContext(); - SrkHttpContextExtensions.SetTimezone(http, tzName); - } - - [TestMethod] - public void GetterWorks() - { - var tzName = "Romance Standard Time"; - var tz = TimeZoneInfo.FindSystemTimeZoneById(tzName); - var http = new BasicHttpContext(); - SrkHttpContextExtensions.SetTimezone(http, tzName); - var result = SrkHttpContextExtensions.GetTimezone(http); - - Assert.IsNotNull(result); - Assert.AreEqual(tz, result); - } - } - } -} +// +// Copyright 2014 SandRock +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +namespace SrkToolkit.Web.Tests +{ + using Microsoft.VisualStudio.TestTools.UnitTesting; + using SrkToolkit.Web.Fakes; + using System; + using System.Collections.Generic; + using System.Linq; + + [TestClass] + public class SrkHttpContextExtensionsTests + { + [TestClass] + public class SetTimezoneMethod + { + [TestMethod] + public void WorksWithTzObject() + { + var tz = TimeZoneInfo.FindSystemTimeZoneById("Romance Standard Time"); + var http = new BasicHttpContext(); + SrkHttpContextExtensions.SetTimezone(http, tz); + + Assert.IsNotNull(http.Items["Timezone"]); + Assert.AreEqual(tz, http.Items["Timezone"]); + } + + [TestMethod] + public void WorksWithTzName() + { + var tzName = "Romance Standard Time"; + var tz = TimeZoneInfo.FindSystemTimeZoneById(tzName); + var http = new BasicHttpContext(); + SrkHttpContextExtensions.SetTimezone(http, tzName); + + Assert.IsNotNull(http.Items["Timezone"]); + Assert.AreEqual(tz, http.Items["Timezone"]); + } + + [TestMethod, ExpectedException(typeof(ArgumentException))] + public void NullTzName() + { + string tzName = null; + var http = new BasicHttpContext(); + SrkHttpContextExtensions.SetTimezone(http, tzName); + } + + [TestMethod, ExpectedException(typeof(ArgumentException))] + public void EmptyTzName() + { + string tzName = string.Empty; + var http = new BasicHttpContext(); + SrkHttpContextExtensions.SetTimezone(http, tzName); + } + + [TestMethod, ExpectedException(typeof(TimeZoneNotFoundException))] + public void InvalidTzName() + { + string tzName = "Lunar Standard Time"; + var http = new BasicHttpContext(); + SrkHttpContextExtensions.SetTimezone(http, tzName); + } + + [TestMethod] + public void GetterWorks() + { + var tzName = "Romance Standard Time"; + var tz = TimeZoneInfo.FindSystemTimeZoneById(tzName); + var http = new BasicHttpContext(); + SrkHttpContextExtensions.SetTimezone(http, tzName); + var result = SrkHttpContextExtensions.GetTimezone(http); + + Assert.IsNotNull(result); + Assert.AreEqual(tz, result); + } + } + } +} diff --git a/Sources/NET4.SrkToolkit.Web.Tests/SrkMvcCollectionExtensionsTests.cs b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkMvcCollectionExtensionsTests.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Web.Tests/SrkMvcCollectionExtensionsTests.cs rename to Sources/SrkToolkit.AspNetCore2.UnitTests/SrkMvcCollectionExtensionsTests.cs diff --git a/Sources/NET4.SrkToolkit.Web.Tests/SrkRequestExtensionsTests.cs b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkRequestExtensionsTests.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Web.Tests/SrkRequestExtensionsTests.cs rename to Sources/SrkToolkit.AspNetCore2.UnitTests/SrkRequestExtensionsTests.cs diff --git a/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkToolkit.AspNetCore2.UnitTests.csproj b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkToolkit.AspNetCore2.UnitTests.csproj new file mode 100644 index 0000000..9ed2389 --- /dev/null +++ b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkToolkit.AspNetCore2.UnitTests.csproj @@ -0,0 +1,39 @@ + + + + net7.0 + disable + disable + + false + + SrkToolkit.AspNetCore.UnitTests + + + + TRACE;ASPMVCCORE + + + + TRACE;ASPMVCCORE + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + + + diff --git a/Sources/NET4.SrkToolkit.Web.Tests/SrkUrlHelperExtensionsTests.cs b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkUrlHelperExtensionsTests.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Web.Tests/SrkUrlHelperExtensionsTests.cs rename to Sources/SrkToolkit.AspNetCore2.UnitTests/SrkUrlHelperExtensionsTests.cs diff --git a/Sources/NET4.SrkToolkit.Web.Tests/WebDependenciesTests.cs b/Sources/SrkToolkit.AspNetCore2.UnitTests/WebDependenciesTests.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Web.Tests/WebDependenciesTests.cs rename to Sources/SrkToolkit.AspNetCore2.UnitTests/WebDependenciesTests.cs diff --git a/Sources/SrkToolkit.Common.CoreUnitTests/SrkToolkit.Common.CoreUnitTests.csproj b/Sources/SrkToolkit.Common.CoreUnitTests/SrkToolkit.Common.CoreUnitTests.csproj new file mode 100644 index 0000000..7b3ccd0 --- /dev/null +++ b/Sources/SrkToolkit.Common.CoreUnitTests/SrkToolkit.Common.CoreUnitTests.csproj @@ -0,0 +1,99 @@ + + + + net7.0 + disable + disable + + false + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + + + + + AssertTests.cs + + + CompositeDisposableTests.cs + + + CultureInfoHelperTests.cs + + + DictionaryWrapperTests.cs + + + DisaposableOnceTests.cs + + + EmailAddressTests.cs + + + EnumStrings.Designer.cs + + + EnumToolsTests.cs + + + ObservableCollectionExtensionsTests.cs + + + SrkArrayExtensionsTests.cs + + + SrkDateTimeExtensionsTests.cs + + + SrkIDictionaryExtensionsTests.cs + + + SrkIListExtensionsTests.cs + + + SrkNameValueCollectionExtensions.cs + + + SrkStringExtensionsTests.cs + + + SrkStringTransformer.cs + + + SrkTimeZoneInfoExtensionsTests.cs + + + StringReplacerTests.cs + + + ValidateTEsts.cs + + + + + + EnumStrings.fr.resx + + + EnumStrings.resx + PublicResXFileCodeGenerator + + + + diff --git a/Sources/SrkToolkit.Common.FxUnitTests/App.config b/Sources/SrkToolkit.Common.FxUnitTests/App.config new file mode 100644 index 0000000..edb3ee9 --- /dev/null +++ b/Sources/SrkToolkit.Common.FxUnitTests/App.config @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Sources/NET4.SrkToolkit.Common.Tests/AssertTests.cs b/Sources/SrkToolkit.Common.FxUnitTests/AssertTests.cs similarity index 69% rename from Sources/NET4.SrkToolkit.Common.Tests/AssertTests.cs rename to Sources/SrkToolkit.Common.FxUnitTests/AssertTests.cs index 1ef44ca..eec1c43 100644 --- a/Sources/NET4.SrkToolkit.Common.Tests/AssertTests.cs +++ b/Sources/SrkToolkit.Common.FxUnitTests/AssertTests.cs @@ -5,14 +5,13 @@ namespace SrkToolkit.Common.Tests using System.Collections.Generic; using System.Linq; using System.Text; - using Microsoft.VisualStudio.TestTools.UnitTesting; + using Xunit; public class AssertTests { - [TestClass] public class AreEqualMethod { - [TestMethod] + [Fact] public void BothNull_Ok() { string expected = null; @@ -20,7 +19,7 @@ public void BothNull_Ok() SrkToolkit.Testing.Assert.AreEqual(expected, actual); } - [TestMethod] + [Fact] public void BothEmpty_Ok() { string expected = ""; @@ -28,23 +27,29 @@ public void BothEmpty_Ok() SrkToolkit.Testing.Assert.AreEqual(expected, actual); } - [TestMethod, ExpectedException(typeof(ArgumentException))] + [Fact] public void NullVsEmpty_Throws() { string expected = null; string actual = ""; - SrkToolkit.Testing.Assert.AreEqual(expected, actual); + Assert.Throws(() => + { + SrkToolkit.Testing.Assert.AreEqual(expected, actual); + }); } - [TestMethod, ExpectedException(typeof(ArgumentException))] + [Fact] public void EmptyVsNull_Throws() { string expected = ""; string actual = null; - SrkToolkit.Testing.Assert.AreEqual(expected, actual); + Assert.Throws(() => + { + SrkToolkit.Testing.Assert.AreEqual(expected, actual); + }); } - [TestMethod] + [Fact] public void SameString_Ok() { string expected = "Tyuhn/*"; @@ -52,83 +57,109 @@ public void SameString_Ok() SrkToolkit.Testing.Assert.AreEqual(expected, actual); } - [TestMethod, ExpectedException(typeof(ArgumentException))] + [Fact] public void ShorterResult_Ok() { string expected = "Tyuhn/*"; string actual = "Tyuhn/"; - SrkToolkit.Testing.Assert.AreEqual(expected, actual); + Assert.Throws(() => + { + SrkToolkit.Testing.Assert.AreEqual(expected, actual); + }); } - [TestMethod, ExpectedException(typeof(ArgumentException))] + [Fact] public void LongerResult_Ok() { string expected = "Tyuhn/*"; string actual = "Tyuhn/*-"; - SrkToolkit.Testing.Assert.AreEqual(expected, actual); + Assert.Throws(() => + { + SrkToolkit.Testing.Assert.AreEqual(expected, actual); + }); } - [TestMethod, ExpectedException(typeof(ArgumentException))] + [Fact] public void DiffAt0_Ok() { string expected = "Tyuhn/*"; string actual = "7yuhn/*"; - SrkToolkit.Testing.Assert.AreEqual(expected, actual); + Assert.Throws(() => + { + SrkToolkit.Testing.Assert.AreEqual(expected, actual); + }); } - [TestMethod, ExpectedException(typeof(ArgumentException))] + [Fact] public void DiffAt1_Ok() { string expected = "Tyuhn/*"; string actual = "T0uhn/*"; - SrkToolkit.Testing.Assert.AreEqual(expected, actual); + Assert.Throws(() => + { + SrkToolkit.Testing.Assert.AreEqual(expected, actual); + }); } - [TestMethod, ExpectedException(typeof(ArgumentException))] + [Fact] public void LongDiffAt15_Ok() { string expected = "aaaaaaaaaaaaaaaTyuhn/*"; string actual = "aaaaaaaaaaaaaaa7yuhn/*"; - SrkToolkit.Testing.Assert.AreEqual(expected, actual); + Assert.Throws(() => + { + SrkToolkit.Testing.Assert.AreEqual(expected, actual); + }); } } - [TestClass] public class ContainsMethod { - [TestMethod, ExpectedException(typeof(ArgumentException))] + [Fact] public void BothNull_Throws() { string expected = null; string actual = null; + Assert.Throws(() => + { SrkToolkit.Testing.Assert.Contains(expected, actual); + }); } - [TestMethod, ExpectedException(typeof(ArgumentException))] + [Fact] public void BothEmpty_Throws() { string expected = ""; string actual = ""; + Assert.Throws(() => + { SrkToolkit.Testing.Assert.Contains(expected, actual); + }); } - [TestMethod, ExpectedException(typeof(ArgumentException))] + [Fact] public void NullVsEmpty_Throws() { string expected = null; string actual = ""; + Assert.Throws(() => + { SrkToolkit.Testing.Assert.Contains(expected, actual); + }); } - [TestMethod, ExpectedException(typeof(ArgumentException))] + [Fact] public void EmptyVsNull_Throws() { string expected = ""; string actual = null; + Assert.Throws(() => + { SrkToolkit.Testing.Assert.Contains(expected, actual); + }); } - [TestMethod] + [Fact] public void SameString_Ok() { string expected = "Tyuhn/*"; @@ -136,7 +167,7 @@ public void SameString_Ok() SrkToolkit.Testing.Assert.Contains(expected, actual); } - [TestMethod] + [Fact] public void Contains_Ok() { string expected = "Tyuhn/*"; @@ -144,7 +175,7 @@ public void Contains_Ok() SrkToolkit.Testing.Assert.Contains(expected, actual); } - [TestMethod] + [Fact] public void DoesNotContain_Ok() { string expected = "ioioioi"; @@ -152,15 +183,15 @@ public void DoesNotContain_Ok() try { SrkToolkit.Testing.Assert.Contains(expected, actual); - Assert.Fail("Expected exception"); + throw new InvalidOperationException("Expected exception"); } catch (ArgumentException ex) { - Assert.AreEqual("Searched string <"+expected+"> was not found.", ex.Message); + Assert.Equal("Searched string <"+expected+"> was not found.", ex.Message); } } - [TestMethod] + [Fact] public void PartialContains2In3_Longer_Throws() { string expected = "rty"; @@ -168,15 +199,15 @@ public void PartialContains2In3_Longer_Throws() try { SrkToolkit.Testing.Assert.Contains(expected, actual); - Assert.Fail("Expected exception"); + throw new InvalidOperationException("Expected exception"); } catch (ArgumentException ex) { - Assert.AreEqual("Searched string was not found. Best partial match:\r\nV> ert_______\r\nS> -rty\r\n ^^", ex.Message); + Assert.Equal("Searched string was not found. Best partial match:\r\nV> ert_______\r\nS> -rty\r\n ^^", ex.Message); } } - [TestMethod] + [Fact] public void PartialContains2In3_Shorter_Throws() { string expected = "rty"; @@ -185,15 +216,15 @@ public void PartialContains2In3_Shorter_Throws() try { SrkToolkit.Testing.Assert.Contains(expected, actual); - Assert.Fail("Expected exception"); + throw new InvalidOperationException("Expected exception"); } catch (ArgumentException ex) { - Assert.AreEqual(expectedMessage, ex.Message); + Assert.Equal(expectedMessage, ex.Message); } } - [TestMethod] + [Fact] public void PartialContains2In3Prefixed_Shorter_Throws() { string expected = "rty"; @@ -202,15 +233,15 @@ public void PartialContains2In3Prefixed_Shorter_Throws() try { SrkToolkit.Testing.Assert.Contains(expected, actual); - Assert.Fail("Expected exception"); + throw new InvalidOperationException("Expected exception"); } catch (ArgumentException ex) { - Assert.AreEqual(expectedMessage, ex.Message); + Assert.Equal(expectedMessage, ex.Message); } } - [TestMethod] + [Fact] public void PartialContains2In3Prefixed_Longer_Throws() { string expected = "rty"; @@ -219,15 +250,15 @@ public void PartialContains2In3Prefixed_Longer_Throws() try { SrkToolkit.Testing.Assert.Contains(expected, actual); - Assert.Fail("Expected exception"); + throw new InvalidOperationException("Expected exception"); } catch (ArgumentException ex) { - Assert.AreEqual(expectedMessage, ex.Message); + Assert.Equal(expectedMessage, ex.Message); } } - [TestMethod] + [Fact] public void PartialContains2In3Prefixed_MuchLonger_Throws() { string expected = "rty"; @@ -236,15 +267,15 @@ public void PartialContains2In3Prefixed_MuchLonger_Throws() try { SrkToolkit.Testing.Assert.Contains(expected, actual); - Assert.Fail("Expected exception"); + throw new InvalidOperationException("Expected exception"); } catch (ArgumentException ex) { - Assert.AreEqual(expectedMessage, ex.Message); + Assert.Equal(expectedMessage, ex.Message); } } - [TestMethod] + [Fact] public void PartialContains3In4_Longer_Throws() { string expected = "rtyu"; @@ -253,15 +284,15 @@ public void PartialContains3In4_Longer_Throws() try { SrkToolkit.Testing.Assert.Contains(expected, actual); - Assert.Fail("Expected exception"); + throw new InvalidOperationException("Expected exception"); } catch (ArgumentException ex) { - Assert.AreEqual(expectedMessage, ex.Message); + Assert.Equal(expectedMessage, ex.Message); } } - [TestMethod] + [Fact] public void PartialContains3In4_Shorter_Throws() { string expected = "rtyu"; @@ -270,15 +301,15 @@ public void PartialContains3In4_Shorter_Throws() try { SrkToolkit.Testing.Assert.Contains(expected, actual); - Assert.Fail("Expected exception"); + throw new InvalidOperationException("Expected exception"); } catch (ArgumentException ex) { - Assert.AreEqual(expectedMessage, ex.Message); + Assert.Equal(expectedMessage, ex.Message); } } - [TestMethod] + [Fact] public void PartialContains3In4Prefixed_Shorter_Throws() { string expected = "rtyu"; @@ -287,15 +318,15 @@ public void PartialContains3In4Prefixed_Shorter_Throws() try { SrkToolkit.Testing.Assert.Contains(expected, actual); - Assert.Fail("Expected exception"); + throw new InvalidOperationException("Expected exception"); } catch (ArgumentException ex) { - Assert.AreEqual(expectedMessage, ex.Message); + Assert.Equal(expectedMessage, ex.Message); } } - [TestMethod] + [Fact] public void PartialContains3In4Prefixed_Longer_Throws() { string expected = "rtyu"; @@ -304,15 +335,15 @@ public void PartialContains3In4Prefixed_Longer_Throws() try { SrkToolkit.Testing.Assert.Contains(expected, actual); - Assert.Fail("Expected exception"); + throw new InvalidOperationException("Expected exception"); } catch (ArgumentException ex) { - Assert.AreEqual(expectedMessage, ex.Message); + Assert.Equal(expectedMessage, ex.Message); } } - [TestMethod] + [Fact] public void PartialContains3In4Prefixed_MuchLonger_Throws() { string expected = "rtyu"; @@ -321,11 +352,11 @@ public void PartialContains3In4Prefixed_MuchLonger_Throws() try { SrkToolkit.Testing.Assert.Contains(expected, actual); - Assert.Fail("Expected exception"); + throw new InvalidOperationException("Expected exception"); } catch (ArgumentException ex) { - Assert.AreEqual(expectedMessage, ex.Message); + Assert.Equal(expectedMessage, ex.Message); } } } diff --git a/Sources/NET4.SrkToolkit.Common.Tests/CompositeDisposableTests.cs b/Sources/SrkToolkit.Common.FxUnitTests/CompositeDisposableTests.cs similarity index 86% rename from Sources/NET4.SrkToolkit.Common.Tests/CompositeDisposableTests.cs rename to Sources/SrkToolkit.Common.FxUnitTests/CompositeDisposableTests.cs index 9edb21b..146a492 100644 --- a/Sources/NET4.SrkToolkit.Common.Tests/CompositeDisposableTests.cs +++ b/Sources/SrkToolkit.Common.FxUnitTests/CompositeDisposableTests.cs @@ -3,17 +3,16 @@ namespace SrkToolkit.Common.Tests { using System; using System.Collections.Generic; + using System.Diagnostics; using System.Linq; using System.Text; - using Microsoft.VisualStudio.TestTools.UnitTesting; - using System.Diagnostics; + using Xunit; public class CompositeDisposableTests { - [TestClass] public class AddMethod { - [TestMethod] + [Fact] public void IsFluent() { // prepare @@ -25,10 +24,10 @@ public void IsFluent() object actual = target.Add(disposable); // verify - Assert.AreSame(expected, actual); + Assert.Same(expected, actual); } - [TestMethod] + [Fact] public void DisposesChildren() { // prepare @@ -40,10 +39,10 @@ public void DisposesChildren() target.Dispose(); // verify - Assert.IsTrue(disposable.IsDisposed); + Assert.True(disposable.IsDisposed); } - [TestMethod] + [Fact] public void MultipleDisposeDoNotThrow() { // prepare @@ -57,7 +56,7 @@ public void MultipleDisposeDoNotThrow() target.Dispose(); } - [TestMethod] + [Fact] public void DisposeAndForget() { // prepare @@ -73,10 +72,10 @@ public void DisposeAndForget() target.Dispose(); // verify - Assert.IsFalse(disposable.IsDisposed); + Assert.False(disposable.IsDisposed); } - [TestMethod] + [Fact] public void IgnoresExceptions() { // prepare diff --git a/Sources/NET4.SrkToolkit.Common.Tests/CultureInfoHelperTests.cs b/Sources/SrkToolkit.Common.FxUnitTests/CultureInfoHelperTests.cs similarity index 66% rename from Sources/NET4.SrkToolkit.Common.Tests/CultureInfoHelperTests.cs rename to Sources/SrkToolkit.Common.FxUnitTests/CultureInfoHelperTests.cs index 22583a6..4ee9beb 100644 --- a/Sources/NET4.SrkToolkit.Common.Tests/CultureInfoHelperTests.cs +++ b/Sources/SrkToolkit.Common.FxUnitTests/CultureInfoHelperTests.cs @@ -1,67 +1,66 @@  namespace SrkToolkit.Common.Tests { + using SrkToolkit.Globalization; using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; - using Microsoft.VisualStudio.TestTools.UnitTesting; - using SrkToolkit.Globalization; + using Xunit; public class CultureInfoHelperTests { - [TestClass] public class GetCountriesMethod { static IList countries = CultureInfoHelper.GetCountries(); - [TestMethod] + [Fact] public void HasUK() { string nativeName = "United Kingdom"; string englishName = "United Kingdom"; var match = countries.SingleOrDefault(c => c.NativeName == nativeName); - Assert.IsNotNull(match); - Assert.AreEqual(englishName, match.EnglishName); - Assert.AreEqual(nativeName, match.NativeName); + Assert.NotNull(match); + Assert.Equal(englishName, match.EnglishName); + Assert.Equal(nativeName, match.NativeName); } - [TestMethod] + [Fact] public void HasUSA() { string nativeName = "United States"; string englishName = "United States"; var match = countries.SingleOrDefault(c => c.NativeName == nativeName); - Assert.IsNotNull(match); - Assert.AreEqual(englishName, match.EnglishName); - Assert.AreEqual(nativeName, match.NativeName); + Assert.NotNull(match); + Assert.Equal(englishName, match.EnglishName); + Assert.Equal(nativeName, match.NativeName); } - [TestMethod] + [Fact] public void HasFrance() { string nativeName = "France"; string englishName = "France"; var match = countries.SingleOrDefault(c => c.NativeName == nativeName); - Assert.IsNotNull(match); - Assert.AreEqual(englishName, match.EnglishName); - Assert.AreEqual(nativeName, match.NativeName); + Assert.NotNull(match); + Assert.Equal(englishName, match.EnglishName); + Assert.Equal(nativeName, match.NativeName); } - [TestMethod] // something is wrong + [Fact] // something is wrong public void HasChina() { string englishName = "China"; var match = countries.SingleOrDefault(c => c.EnglishName == englishName); - Assert.IsNotNull(match); + Assert.NotNull(match); } - [TestMethod] // something is wrong + [Fact] // something is wrong public void HasChina2() { string nativeName = "ཀྲུང་ཧྭ་མི་དམངས་སྤྱི་མཐུན་རྒྱལ་ཁབ"; @@ -69,7 +68,7 @@ public void HasChina2() string cultureName = "zh-CN"; var match = countries.SingleOrDefault(c => c.EnglishName == englishName); - Assert.IsNotNull(match); + Assert.NotNull(match); } } diff --git a/Sources/NET4.SrkToolkit.Common.Tests/DataAnnotations/CultureInfoAttributeTests.cs b/Sources/SrkToolkit.Common.FxUnitTests/DataAnnotations/CultureInfoAttributeTests.cs similarity index 72% rename from Sources/NET4.SrkToolkit.Common.Tests/DataAnnotations/CultureInfoAttributeTests.cs rename to Sources/SrkToolkit.Common.FxUnitTests/DataAnnotations/CultureInfoAttributeTests.cs index 80a0be1..ad6f4f1 100644 --- a/Sources/NET4.SrkToolkit.Common.Tests/DataAnnotations/CultureInfoAttributeTests.cs +++ b/Sources/SrkToolkit.Common.FxUnitTests/DataAnnotations/CultureInfoAttributeTests.cs @@ -1,49 +1,48 @@  namespace SrkToolkit.Common.Tests.DataAnnotations { + using SrkToolkit.DataAnnotations; using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; - using Microsoft.VisualStudio.TestTools.UnitTesting; - using SrkToolkit.DataAnnotations; using System.ComponentModel.DataAnnotations; + using Xunit; - [TestClass] public class CultureInfoAttributeTests { - [TestMethod] + [Fact] public void ReturnsTrueWithEmptyValue() { var attr = new CultureInfoAttribute(); string value = string.Empty; bool expected = true; bool result = attr.IsValid(value); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void ReturnsTrueWithNullValue() { var attr = new CultureInfoAttribute(); string value = null; bool expected = true; bool result = attr.IsValid(value); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void ReturnsTrueWithValidValue() { var attr = new CultureInfoAttribute(); string value = "fr-FR"; bool expected = true; bool result = attr.IsValid(value); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void AllowNeutral_ReturnsTrueWithNeutral() { var attr = new CultureInfoAttribute(); @@ -51,10 +50,10 @@ public void AllowNeutral_ReturnsTrueWithNeutral() string value = "fr"; bool expected = true; bool result = attr.IsValid(value); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void AllowNeutral_ReturnsTrueWithNonNeutral() { var attr = new CultureInfoAttribute(); @@ -62,10 +61,10 @@ public void AllowNeutral_ReturnsTrueWithNonNeutral() string value = "fr-CA"; bool expected = true; bool result = attr.IsValid(value); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void DisallowNeutral_ReturnsFalseWithNeutral() { var attr = new CultureInfoAttribute(); @@ -74,13 +73,13 @@ public void DisallowNeutral_ReturnsFalseWithNeutral() var context = new ValidationContext(new object(), null, null); context.MemberName = name; var result = attr.GetValidationResult(value, context); - Assert.IsNotNull(result); - Assert.AreEqual("The culture is not valid.", result.ErrorMessage); - Assert.AreEqual(1, result.MemberNames.Count()); - Assert.AreEqual(name, result.MemberNames.Single()); + Assert.NotNull(result); + Assert.Equal("The culture is not valid.", result.ErrorMessage); + Assert.Equal(1, result.MemberNames.Count()); + Assert.Equal(name, result.MemberNames.Single()); } - [TestMethod] + [Fact] public void DisallowNeutral_ReturnsTrueWithNonNeutral() { var attr = new CultureInfoAttribute(); @@ -88,14 +87,14 @@ public void DisallowNeutral_ReturnsTrueWithNonNeutral() string value = "fr-CA"; bool expected = true; bool result = attr.IsValid(value); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void DoNotAllowNeutralByDefault() { var attr = new CultureInfoAttribute(); - Assert.IsFalse(attr.AllowNeutralCulture); + Assert.False(attr.AllowNeutralCulture); } } } diff --git a/Sources/NET4.SrkToolkit.Common.Tests/DataAnnotations/EmailAddressExAttributeTests.cs b/Sources/SrkToolkit.Common.FxUnitTests/DataAnnotations/EmailAddressExAttributeTests.cs similarity index 79% rename from Sources/NET4.SrkToolkit.Common.Tests/DataAnnotations/EmailAddressExAttributeTests.cs rename to Sources/SrkToolkit.Common.FxUnitTests/DataAnnotations/EmailAddressExAttributeTests.cs index 1bf649f..1060d63 100644 --- a/Sources/NET4.SrkToolkit.Common.Tests/DataAnnotations/EmailAddressExAttributeTests.cs +++ b/Sources/SrkToolkit.Common.FxUnitTests/DataAnnotations/EmailAddressExAttributeTests.cs @@ -1,21 +1,20 @@  namespace SrkToolkit.Common.Tests.DataAnnotations { - using Microsoft.VisualStudio.TestTools.UnitTesting; using SrkToolkit.DataAnnotations; using System; using System.Collections.Generic; using System.Linq; using System.Text; + using Xunit; - [TestClass] public class EmailAddressExAttributeTests { -#if NET40 +#if NET40 || NETFRAMEWORK #else #endif -#if NET40 +#if NET40 || NETFRAMEWORK private static EmailAddressAttribute GetTarget() { return new EmailAddressAttribute(); @@ -27,175 +26,175 @@ private static EmailAddressExAttribute GetTarget() } #endif - [TestMethod] + [Fact] public void AllowOne_NullValue_Pass() { string input = null; var target = GetTarget(); var result = target.IsValid(input); - Assert.IsTrue(result); + Assert.True(result); } - [TestMethod] + [Fact] public void AllowOne_EmptyValue_Pass() { string input = string.Empty; var target = GetTarget(); var result = target.IsValid(input); - Assert.IsTrue(result); + Assert.True(result); } - [TestMethod] + [Fact] public void AllowOne_WhiteValue_Pass() { string input = " "; var target = GetTarget(); var result = target.IsValid(input); - Assert.IsTrue(result); + Assert.True(result); } - [TestMethod] + [Fact] public void AllowOne_BasicAddress_Pass() { string input = "michel.salamander@yahoooo.com"; var target = GetTarget(); var result = target.IsValid(input); - Assert.IsTrue(result); + Assert.True(result); } - [TestMethod] + [Fact] public void AllowOne_BasicAddressWithTag_Pass() { string input = "michel.salamander+hello-world@yahoooo.com"; var target = GetTarget(); var result = target.IsValid(input); - Assert.IsTrue(result); + Assert.True(result); } - [TestMethod] + [Fact] public void AllowOne_BasicAddressWithDiacritics_Pass() { string input = "michél.salamânder@yahoooo.com"; var target = GetTarget(); var result = target.IsValid(input); - Assert.IsTrue(result); + Assert.True(result); } - [TestMethod] + [Fact] public void AllowOne_InvalidAddress1_Fail() { string input = "michél salamânder@yahoooo.com"; var target = GetTarget(); var result = target.IsValid(input); - Assert.IsFalse(result); + Assert.False(result); } - [TestMethod] + [Fact] public void AllowOne_InvalidAddress2_Fail() { string input = "michel salamander@yahoooo.com"; var target = GetTarget(); var result = target.IsValid(input); - Assert.IsFalse(result); + Assert.False(result); } - [TestMethod] + [Fact] public void AllowOne_InvalidAddress3_Fail() { string input = "michel.salamander.yahoooo.com"; var target = GetTarget(); var result = target.IsValid(input); - Assert.IsFalse(result); + Assert.False(result); } - [TestMethod] + [Fact] public void AllowOne_InvalidAddress4_Fail() { string input = "hello"; var target = GetTarget(); var result = target.IsValid(input); - Assert.IsFalse(result); + Assert.False(result); } - [TestMethod] + [Fact] public void AllowOne_InvalidAddress5_Fail() { string input = ".@test.com"; var target = GetTarget(); var result = target.IsValid(input); - Assert.IsFalse(result); + Assert.False(result); } - [TestMethod] + [Fact] public void AllowOne_BasicAddressUntrimmed_Fail() { string input = " michel.salamander@yahoooo.com "; var target = GetTarget(); var result = target.IsValid(input); - Assert.IsFalse(result); + Assert.False(result); } - [TestMethod] + [Fact] public void AllowMultiple_NullValue_Pass() { string input = null; var target = GetTarget(); target.AllowMultiple = true; var result = target.IsValid(input); - Assert.IsTrue(result); + Assert.True(result); } - [TestMethod] + [Fact] public void AllowMultiple_EmptyValue_Pass() { string input = string.Empty; var target = GetTarget(); target.AllowMultiple = true; var result = target.IsValid(input); - Assert.IsTrue(result); + Assert.True(result); } - [TestMethod] + [Fact] public void AllowMultiple_WhiteValue_Pass() { string input = " "; var target = GetTarget(); target.AllowMultiple = true; var result = target.IsValid(input); - Assert.IsTrue(result); + Assert.True(result); } - [TestMethod] + [Fact] public void AllowMultiple_BasicAddress1_Pass() { string input = "michel.salamander@yahoooo.com"; var target = GetTarget(); target.AllowMultiple = true; var result = target.IsValid(input); - Assert.IsTrue(result); + Assert.True(result); } - [TestMethod] + [Fact] public void AllowMultiple_BasicAddress2_Pass() { string input = "michel.salamander@yahoooo.com michel.salamander@yahoooo.com"; var target = GetTarget(); target.AllowMultiple = true; var result = target.IsValid(input); - Assert.IsTrue(result); + Assert.True(result); } - [TestMethod] + [Fact] public void AllowMultiple_BasicAddress2Untrimmed_Pass() { string input = " michel.salamander@yahoooo.com \r\nmichel.salamander@yahoooo.com "; var target = GetTarget(); target.AllowMultiple = true; var result = target.IsValid(input); - Assert.IsTrue(result); + Assert.True(result); } - [TestMethod] + [Fact] public void AllowMultiple_BelowMinimum_Fail() { string input = "michel.salamander@yahoooo.com"; @@ -203,10 +202,10 @@ public void AllowMultiple_BelowMinimum_Fail() target.AllowMultiple = true; target.MinimumAddresses = 2; var result = target.IsValid(input); - Assert.IsFalse(result); + Assert.False(result); } - [TestMethod] + [Fact] public void AllowMultiple_AtMinimum_Pass() { string input = " michel.salamander@yahoooo.com \r\nmichel.salamander@yahoooo.com "; @@ -214,10 +213,10 @@ public void AllowMultiple_AtMinimum_Pass() target.AllowMultiple = true; target.MinimumAddresses = 2; var result = target.IsValid(input); - Assert.IsTrue(result); + Assert.True(result); } - [TestMethod] + [Fact] public void AllowMultiple_AboveMinimum_Pass() { string input = " michel.salamander@yahoooo.com \r\nmichel.salamander@yahoooo.com test@test.com"; @@ -225,10 +224,10 @@ public void AllowMultiple_AboveMinimum_Pass() target.AllowMultiple = true; target.MinimumAddresses = 2; var result = target.IsValid(input); - Assert.IsTrue(result); + Assert.True(result); } - [TestMethod] + [Fact] public void AllowMultiple_AboveMaximum_Fail() { string input = " michel.salamander@yahoooo.com \r\nmichel.salamander@yahoooo.com test@test.com"; @@ -236,10 +235,10 @@ public void AllowMultiple_AboveMaximum_Fail() target.AllowMultiple = true; target.MaximumAddresses = 2; var result = target.IsValid(input); - Assert.IsFalse(result); + Assert.False(result); } - [TestMethod] + [Fact] public void AllowMultiple_AtMaximum_Pass() { string input = " michel.salamander@yahoooo.com \r\nmichel.salamander@yahoooo.com "; @@ -247,10 +246,10 @@ public void AllowMultiple_AtMaximum_Pass() target.AllowMultiple = true; target.MaximumAddresses = 2; var result = target.IsValid(input); - Assert.IsTrue(result); + Assert.True(result); } - [TestMethod] + [Fact] public void AllowMultiple_BelowMaximum_Pass() { string input = "michel.salamander@yahoooo.com"; @@ -258,7 +257,7 @@ public void AllowMultiple_BelowMaximum_Pass() target.AllowMultiple = true; target.MaximumAddresses = 2; var result = target.IsValid(input); - Assert.IsTrue(result); + Assert.True(result); } } } diff --git a/Sources/NET4.SrkToolkit.Common.Tests/DataAnnotations/PhoneNumberAttributeTests.cs b/Sources/SrkToolkit.Common.FxUnitTests/DataAnnotations/PhoneNumberAttributeTests.cs similarity index 64% rename from Sources/NET4.SrkToolkit.Common.Tests/DataAnnotations/PhoneNumberAttributeTests.cs rename to Sources/SrkToolkit.Common.FxUnitTests/DataAnnotations/PhoneNumberAttributeTests.cs index 348efc1..ad02b71 100644 --- a/Sources/NET4.SrkToolkit.Common.Tests/DataAnnotations/PhoneNumberAttributeTests.cs +++ b/Sources/SrkToolkit.Common.FxUnitTests/DataAnnotations/PhoneNumberAttributeTests.cs @@ -1,23 +1,21 @@  namespace SrkToolkit.Common.Tests.DataAnnotations { + using SrkToolkit.DataAnnotations; using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Text.RegularExpressions; - using Microsoft.VisualStudio.TestTools.UnitTesting; - using SrkToolkit.DataAnnotations; using System.ComponentModel.DataAnnotations; + using Xunit; - [TestClass] public class PhoneNumberAttributeTests { - [TestClass] public class RegexTests { - [TestMethod] + [Fact] public void StupidInputFails() { // prepare @@ -29,10 +27,10 @@ public void StupidInputFails() result = target.IsMatch(input); // verify - Assert.IsFalse(result, "Should not allow stupid input"); + Assert.False(result, "Should not allow stupid input"); } - [TestMethod] + [Fact] public void LocalNumberFails() { // prepare @@ -44,10 +42,10 @@ public void LocalNumberFails() result = target.IsMatch(input); // verify - Assert.IsFalse(result, "Should not allow local numbers"); + Assert.False(result, "Should not allow local numbers"); } - [TestMethod] + [Fact] public void ValidNumberAreAllowed() { // prepare @@ -59,10 +57,10 @@ public void ValidNumberAreAllowed() result = target.IsMatch(input); // verify - Assert.IsTrue(result, "Valid numbers should pass"); + Assert.True(result, "Valid numbers should pass"); } - [TestMethod] + [Fact] public void SeparatorsAreAllowed() { // prepare @@ -74,99 +72,104 @@ public void SeparatorsAreAllowed() result = target.IsMatch(input); // verify - Assert.IsTrue(result, "Separators should pass validation"); + Assert.True(result, "Separators should pass validation"); } } - [TestClass] public class ConvertNationalToInternationalMethod { - [TestMethod, ExpectedException(typeof(ArgumentException))] + [Fact] public void EmptyIsInvalid() { string input = "", output = null; CultureInfo culture = CultureInfo.InvariantCulture; - Assert.IsFalse(PhoneNumberAttribute.ConvertNationalToInternational(input, culture, out output)); - Assert.IsNull(output); + Assert.Throws(() => + { + Assert.False(PhoneNumberAttribute.ConvertNationalToInternational(input, culture, out output)); + Assert.Null(output); + }); } - [TestMethod] + [Fact] public void InternationalBasicWorks() { string input = "+33123456789", output = null; CultureInfo culture = CultureInfo.InvariantCulture; - Assert.IsTrue(PhoneNumberAttribute.ConvertNationalToInternational(input, culture, out output)); - Assert.AreEqual(input, output); + Assert.True(PhoneNumberAttribute.ConvertNationalToInternational(input, culture, out output)); + Assert.Equal(input, output); } - [TestMethod] + [Fact] public void InternationalSpacedWorks() { string input = "+33 123 456 789", output = null; CultureInfo culture = CultureInfo.InvariantCulture; - Assert.IsTrue(PhoneNumberAttribute.ConvertNationalToInternational(input, culture, out output)); - Assert.AreEqual(input, output); + Assert.True(PhoneNumberAttribute.ConvertNationalToInternational(input, culture, out output)); + Assert.Equal(input, output); } - [TestMethod] + [Fact] public void InternationalDashedWorks() { string input = "+33-123-456-789", output = null; CultureInfo culture = CultureInfo.InvariantCulture; - Assert.IsTrue(PhoneNumberAttribute.ConvertNationalToInternational(input, culture, out output)); - Assert.AreEqual(input, output); + Assert.True(PhoneNumberAttribute.ConvertNationalToInternational(input, culture, out output)); + Assert.Equal(input, output); } - [TestMethod] + [Fact] public void InternationalDottedWorks() { string input = "+33.123.456.789", output = null; CultureInfo culture = CultureInfo.InvariantCulture; - Assert.IsTrue(PhoneNumberAttribute.ConvertNationalToInternational(input, culture, out output)); - Assert.AreEqual(input, output); + Assert.True(PhoneNumberAttribute.ConvertNationalToInternational(input, culture, out output)); + Assert.Equal(input, output); } - [TestMethod, ExpectedException(typeof(InvalidOperationException))] + [Fact] public void NationalInvariantFails() { string input = "123.456.789", output = null; CultureInfo culture = CultureInfo.InvariantCulture; - Assert.IsFalse(PhoneNumberAttribute.ConvertNationalToInternational(input, culture, out output)); - Assert.IsNull(output); + Assert.Throws(() => + { + Assert.False(PhoneNumberAttribute.ConvertNationalToInternational(input, culture, out output)); + Assert.Null(output); + }); } } - [TestMethod] + [Fact] public void ReturnsTrueWithEmptyValue() { var attr = new PhoneNumberAttribute(); string value = string.Empty; bool expected = true; bool result = attr.IsValid(value); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void ReturnsTrueWithNullValue() { var attr = new PhoneNumberAttribute(); string value = null; bool expected = true; bool result = attr.IsValid(value); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void ReturnsTrueWithValidValue() { var attr = new PhoneNumberAttribute(); string value = "+33123456798"; bool expected = true; bool result = attr.IsValid(value); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void ReturnsFalseWithObviousInvalid() { var attr = new PhoneNumberAttribute(); @@ -174,10 +177,10 @@ public void ReturnsFalseWithObviousInvalid() var context = new ValidationContext(new object(), null, null); context.MemberName = name; var result = attr.GetValidationResult(value, context); - Assert.IsNotNull(result); - Assert.AreEqual("Use the international phone number format (+xxyyyyyyyyyy).", result.ErrorMessage); - Assert.AreEqual(1, result.MemberNames.Count()); - Assert.AreEqual(name, result.MemberNames.Single()); + Assert.NotNull(result); + Assert.Equal("Use the international phone number format (+xxyyyyyyyyyy).", result.ErrorMessage); + Assert.Equal(1, result.MemberNames.Count()); + Assert.Equal(name, result.MemberNames.Single()); } } } diff --git a/Sources/NET4.SrkToolkit.Common.Tests/DataAnnotations/TimezoneAttributeTests.cs b/Sources/SrkToolkit.Common.FxUnitTests/DataAnnotations/TimezoneAttributeTests.cs similarity index 72% rename from Sources/NET4.SrkToolkit.Common.Tests/DataAnnotations/TimezoneAttributeTests.cs rename to Sources/SrkToolkit.Common.FxUnitTests/DataAnnotations/TimezoneAttributeTests.cs index 6157a27..55185f5 100644 --- a/Sources/NET4.SrkToolkit.Common.Tests/DataAnnotations/TimezoneAttributeTests.cs +++ b/Sources/SrkToolkit.Common.FxUnitTests/DataAnnotations/TimezoneAttributeTests.cs @@ -1,24 +1,23 @@  namespace SrkToolkit.Common.Tests.DataAnnotations { + using SrkToolkit.DataAnnotations; using System; using System.Collections.Generic; using System.Linq; using System.Text; - using Microsoft.VisualStudio.TestTools.UnitTesting; - using SrkToolkit.DataAnnotations; using System.ComponentModel.DataAnnotations; + using Xunit; - [TestClass] public class TimezoneAttributeTests { - [TestMethod] + [Fact] public void Constructs() { var value = new TimezoneAttribute(); } - [TestMethod] + [Fact] public void Model_ValidTz_Pass() { var model = new Model @@ -26,10 +25,10 @@ public void Model_ValidTz_Pass() Tz = "Romance Standard Time", }; var attr = (TimezoneAttribute)model.GetType().GetProperty("Tz").GetCustomAttributes(false).First(); - Assert.IsTrue(attr.IsValid(model.Tz)); + Assert.True(attr.IsValid(model.Tz)); } - [TestMethod] + [Fact] public void Model_NullTz_Pass() { var model = new Model @@ -37,10 +36,10 @@ public void Model_NullTz_Pass() Tz = null, }; var attr = (TimezoneAttribute)model.GetType().GetProperty("Tz").GetCustomAttributes(false).First(); - Assert.IsTrue(attr.IsValid(model.Tz)); + Assert.True(attr.IsValid(model.Tz)); } - [TestMethod] + [Fact] public void Model_EmptyTz_Pass() { var model = new Model @@ -48,10 +47,10 @@ public void Model_EmptyTz_Pass() Tz = "", }; var attr = (TimezoneAttribute)model.GetType().GetProperty("Tz").GetCustomAttributes(false).First(); - Assert.IsTrue(attr.IsValid(model.Tz)); + Assert.True(attr.IsValid(model.Tz)); } - [TestMethod] + [Fact] public void Model_InvalidTz_Invalid() { var model = new Model @@ -59,10 +58,10 @@ public void Model_InvalidTz_Invalid() Tz = "Paris", // not a valid timezone id }; var attr = (TimezoneAttribute)model.GetType().GetProperty("Tz").GetCustomAttributes(false).First(); - Assert.IsFalse(attr.IsValid(model.Tz)); + Assert.False(attr.IsValid(model.Tz)); } - [TestMethod] + [Fact] public void InvalidTz_Invalid() { var attr = new TimezoneAttribute(); @@ -70,10 +69,10 @@ public void InvalidTz_Invalid() var context = new ValidationContext(new object(), null, null); context.MemberName = name; var result = attr.GetValidationResult(value, context); - Assert.IsNotNull(result); - Assert.AreEqual(@"The timezone is not valid.", result.ErrorMessage); - Assert.AreEqual(1, result.MemberNames.Count()); - Assert.AreEqual(name, result.MemberNames.Single()); + Assert.NotNull(result); + Assert.Equal(@"The timezone is not valid.", result.ErrorMessage); + Assert.Equal(1, result.MemberNames.Count()); + Assert.Equal(name, result.MemberNames.Single()); } public class Model diff --git a/Sources/SrkToolkit.Common.FxUnitTests/DataAnnotations/TwitterUsernameAttributeTests.cs b/Sources/SrkToolkit.Common.FxUnitTests/DataAnnotations/TwitterUsernameAttributeTests.cs new file mode 100644 index 0000000..a044a75 --- /dev/null +++ b/Sources/SrkToolkit.Common.FxUnitTests/DataAnnotations/TwitterUsernameAttributeTests.cs @@ -0,0 +1,163 @@ + +namespace Sparkle.UnitTests +{ + using SrkToolkit.DataAnnotations; + using System; + using System.Collections.Generic; + using System.ComponentModel.DataAnnotations; + using System.Linq; + using System.Text; + using System.Text.RegularExpressions; + using System.Threading.Tasks; + using Xunit; + + public class TwitterUsernameAttributeTests + { + public class RegexTests + { + private Regex TwitterRegex; + + public RegexTests() + { + this.TwitterRegex = new Regex(TwitterUsernameAttribute.TwitterRegex, RegexOptions.Compiled); + } + + [Fact] + public void TwitterUsernameNoMatch() + { + Assert.False(this.TwitterRegex.IsMatch("é'çà&=")); + Assert.False(this.TwitterRegex.IsMatch("user@name")); + Assert.False(this.TwitterRegex.IsMatch("usernamereallytoolong")); + } + + [Fact] + public void TwitterUsernameMatch() + { + Assert.True(this.TwitterRegex.IsMatch("username")); + Assert.True(this.TwitterRegex.IsMatch("user_name")); + Assert.True(this.TwitterRegex.IsMatch("@username")); + } + + [Fact] + public void TwitterWeirdUrlMatch() + { + Assert.True(this.TwitterRegex.IsMatch("twitter/username")); + Assert.True(this.TwitterRegex.IsMatch("twitter/@username")); + } + + [Fact] + public void TwitterUrlWithoutProtocolMatch() + { + Assert.True(this.TwitterRegex.IsMatch("twitter.com/username")); + Assert.True(this.TwitterRegex.IsMatch("twitter.com/@username")); + Assert.True(this.TwitterRegex.IsMatch("www.twitter.com/username")); + Assert.True(this.TwitterRegex.IsMatch("www.twitter.com/@username")); + } + + [Fact] + public void TwitterUrlWithProtocolMatch() + { + Assert.True(this.TwitterRegex.IsMatch("http://twitter.com/username")); + Assert.True(this.TwitterRegex.IsMatch("https://twitter.com/username")); + Assert.True(this.TwitterRegex.IsMatch("http://twitter.com/@username")); + Assert.True(this.TwitterRegex.IsMatch("https://twitter.com/@username")); + Assert.True(this.TwitterRegex.IsMatch("http://www.twitter.com/username")); + Assert.True(this.TwitterRegex.IsMatch("https://www.twitter.com/username")); + Assert.True(this.TwitterRegex.IsMatch("http://www.twitter.com/@username")); + Assert.True(this.TwitterRegex.IsMatch("https://www.twitter.com/@username")); + } + } + + public class GetUsernameMethod + { + [Fact] + public void TwitterGetUsernameFail() + { + string username = null; + + Assert.False(TwitterUsernameAttribute.GetUsername("é'çà&=", out username)); + Assert.Null(username); + Assert.False(TwitterUsernameAttribute.GetUsername("user@name", out username)); + Assert.Null(username); + Assert.False(TwitterUsernameAttribute.GetUsername("usernamereallytoolong", out username)); + Assert.Null(username); + } + + [Fact] + public void TwitterGetUsernameSuccess() + { + string username = null; + + Assert.True(TwitterUsernameAttribute.GetUsername("username", out username)); + Assert.Equal("username", username); + Assert.True(TwitterUsernameAttribute.GetUsername("user_name", out username)); + Assert.Equal("user_name", username); + Assert.True(TwitterUsernameAttribute.GetUsername("@username", out username)); + Assert.Equal("username", username); + } + + [Fact] + public void TwitterGetUsernameFromWeirdUrl() + { + string username = null; + + Assert.True(TwitterUsernameAttribute.GetUsername("twitter/username", out username)); + Assert.Equal("username", username); + Assert.True(TwitterUsernameAttribute.GetUsername("twitter/@username", out username)); + Assert.Equal("username", username); + } + + [Fact] + public void TwitterGetUsernameFromUrlWithoutProtocol() + { + string username = null; + + Assert.True(TwitterUsernameAttribute.GetUsername("twitter.com/username", out username)); + Assert.Equal("username", username); + Assert.True(TwitterUsernameAttribute.GetUsername("twitter.com/@username", out username)); + Assert.Equal("username", username); + Assert.True(TwitterUsernameAttribute.GetUsername("www.twitter.com/username", out username)); + Assert.Equal("username", username); + Assert.True(TwitterUsernameAttribute.GetUsername("www.twitter.com/@username", out username)); + Assert.Equal("username", username); + } + + [Fact] + public void TwitterGetUsernameFromUrlWithProtocol() + { + string username = null; + + Assert.True(TwitterUsernameAttribute.GetUsername("http://twitter.com/username", out username)); + Assert.Equal("username", username); + Assert.True(TwitterUsernameAttribute.GetUsername("http://twitter.com/@username", out username)); + Assert.Equal("username", username); + Assert.True(TwitterUsernameAttribute.GetUsername("http://www.twitter.com/username", out username)); + Assert.Equal("username", username); + Assert.True(TwitterUsernameAttribute.GetUsername("http://www.twitter.com/@username", out username)); + Assert.Equal("username", username); + Assert.True(TwitterUsernameAttribute.GetUsername("https://twitter.com/username", out username)); + Assert.Equal("username", username); + Assert.True(TwitterUsernameAttribute.GetUsername("https://twitter.com/@username", out username)); + Assert.Equal("username", username); + Assert.True(TwitterUsernameAttribute.GetUsername("https://www.twitter.com/username", out username)); + Assert.Equal("username", username); + Assert.True(TwitterUsernameAttribute.GetUsername("https://www.twitter.com/@username", out username)); + Assert.Equal("username", username); + } + } + + [Fact] + public void ObviousInvalid() + { + var attr = new TwitterUsernameAttribute(); + string value = "foo bar", name = "Twitter"; + var context = new ValidationContext(new object(), null, null); + context.MemberName = name; + var result = attr.GetValidationResult(value, context); + Assert.NotNull(result); + Assert.Equal(@"Invalid Twitter username. You must provide the username or the url to your account.", result.ErrorMessage); + Assert.Equal(1, result.MemberNames.Count()); + Assert.Equal(name, result.MemberNames.Single()); + } + } +} diff --git a/Sources/NET4.SrkToolkit.Common.Tests/DateRangeAttributeTests.cs b/Sources/SrkToolkit.Common.FxUnitTests/DateRangeAttributeTests.cs similarity index 77% rename from Sources/NET4.SrkToolkit.Common.Tests/DateRangeAttributeTests.cs rename to Sources/SrkToolkit.Common.FxUnitTests/DateRangeAttributeTests.cs index a787eff..76797ad 100644 --- a/Sources/NET4.SrkToolkit.Common.Tests/DateRangeAttributeTests.cs +++ b/Sources/SrkToolkit.Common.FxUnitTests/DateRangeAttributeTests.cs @@ -1,70 +1,69 @@ - -namespace SrkToolkit.Common.Tests -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Text; - using Microsoft.VisualStudio.TestTools.UnitTesting; - using SrkToolkit.DataAnnotations; - using System.ComponentModel.DataAnnotations; - - [TestClass] - public class DateRangeAttributeTests - { - [TestMethod] - public void NullValue_IsValid() - { - string value = null, name = "Date"; - var attr = new DateRangeAttribute(); - var context = new ValidationContext(new object(), null, null); - context.MemberName = name; - var result = attr.GetValidationResult(value, context); - - Assert.IsNull(result); - } - - [TestMethod] - public void EmptyValue_IsValid() - { - string value = "", name = "Date"; - var attr = new DateRangeAttribute(); - var context = new ValidationContext(new object(), null, null); - context.MemberName = name; - var result = attr.GetValidationResult(value, context); - - Assert.IsNull(result); - } - - [TestMethod] - public void InvalidValue_IsInvalid() - { - string value = "test", name = "Date"; - var attr = new DateRangeAttribute(); - attr.Minimum = "2015-01-01T00:00:00"; - attr.Maximum = "2015-01-03T00:00:00"; - var context = new ValidationContext(new object(), null, null); - context.MemberName = name; - var result = attr.GetValidationResult(value, context); - - Assert.IsNotNull(result); - Assert.AreEqual("The field Date must be between 2015-01-01 00:00:00 and 2015-01-03 00:00:00.", result.ErrorMessage); - Assert.AreEqual(1, result.MemberNames.Count()); - Assert.AreEqual(name, result.MemberNames.Single()); - } - - [TestMethod] - public void ValidValue_IsValid() - { - string value = "2015-01-02T01:00:02", name = "Date"; - var attr = new DateRangeAttribute(); - attr.Minimum = "2015-01-01T00:00:00"; - attr.Maximum = "2015-01-03T00:00:00"; - var context = new ValidationContext(new object(), null, null); - context.MemberName = name; - var result = attr.GetValidationResult(value, context); - - Assert.IsNull(result); - } - } -} + +namespace SrkToolkit.Common.Tests +{ + using SrkToolkit.DataAnnotations; + using System; + using System.Collections.Generic; + using System.ComponentModel.DataAnnotations; + using System.Linq; + using System.Text; + using Xunit; + + public class DateRangeAttributeTests + { + [Fact] + public void NullValue_IsValid() + { + string value = null, name = "Date"; + var attr = new DateRangeAttribute(); + var context = new ValidationContext(new object(), null, null); + context.MemberName = name; + var result = attr.GetValidationResult(value, context); + + Assert.Null(result); + } + + [Fact] + public void EmptyValue_IsValid() + { + string value = "", name = "Date"; + var attr = new DateRangeAttribute(); + var context = new ValidationContext(new object(), null, null); + context.MemberName = name; + var result = attr.GetValidationResult(value, context); + + Assert.Null(result); + } + + [Fact] + public void InvalidValue_IsInvalid() + { + string value = "test", name = "Date"; + var attr = new DateRangeAttribute(); + attr.Minimum = "2015-01-01T00:00:00"; + attr.Maximum = "2015-01-03T00:00:00"; + var context = new ValidationContext(new object(), null, null); + context.MemberName = name; + var result = attr.GetValidationResult(value, context); + + Assert.NotNull(result); + Assert.Equal("The field Date must be between 2015-01-01 00:00:00 and 2015-01-03 00:00:00.", result.ErrorMessage); + Assert.Equal(1, result.MemberNames.Count()); + Assert.Equal(name, result.MemberNames.Single()); + } + + [Fact] + public void ValidValue_IsValid() + { + string value = "2015-01-02T01:00:02", name = "Date"; + var attr = new DateRangeAttribute(); + attr.Minimum = "2015-01-01T00:00:00"; + attr.Maximum = "2015-01-03T00:00:00"; + var context = new ValidationContext(new object(), null, null); + context.MemberName = name; + var result = attr.GetValidationResult(value, context); + + Assert.Null(result); + } + } +} diff --git a/Sources/NET4.SrkToolkit.Common.Tests/DictionaryWrapperTests.cs b/Sources/SrkToolkit.Common.FxUnitTests/DictionaryWrapperTests.cs similarity index 64% rename from Sources/NET4.SrkToolkit.Common.Tests/DictionaryWrapperTests.cs rename to Sources/SrkToolkit.Common.FxUnitTests/DictionaryWrapperTests.cs index b5e18a6..c57b8e9 100644 --- a/Sources/NET4.SrkToolkit.Common.Tests/DictionaryWrapperTests.cs +++ b/Sources/SrkToolkit.Common.FxUnitTests/DictionaryWrapperTests.cs @@ -1,60 +1,64 @@  namespace SrkToolkit.Common.Tests { + using SrkToolkit.Collections; using System; using System.Collections.Generic; using System.Linq; using System.Text; - using SrkToolkit.Collections; - using Microsoft.VisualStudio.TestTools.UnitTesting; + using Xunit; - [TestClass] public class DictionaryWrapperTests { - [TestClass] public class WrappedHashtableTests { - [TestMethod] + [Fact] public void AddOnce_StringInt() { string key = "kk"; int value = 42; var target = new DictionaryWrapper(new System.Collections.Hashtable()); target.Add(key, value); - Assert.IsTrue(target.Count == 1); + Assert.True(target.Count == 1); } - [TestMethod] + [Fact] public void AddOnce_StringObject() { string key = "kk"; object value = new object(); var target = new DictionaryWrapper(new System.Collections.Hashtable()); target.Add(key, value); - Assert.IsTrue(target.Count == 1); + Assert.True(target.Count == 1); } - [TestMethod, ExpectedException(typeof(ArgumentException))] + [Fact] public void AddTwice_StringInt() { string key = "kk"; int value = 42; - var target = new DictionaryWrapper(new System.Collections.Hashtable()); - target.Add(key, value); - target.Add(key, value); + Assert.Throws(() => + { + var target = new DictionaryWrapper(new System.Collections.Hashtable()); + target.Add(key, value); + target.Add(key, value); + }); } - [TestMethod, ExpectedException(typeof(ArgumentException))] + [Fact] public void AddTwice_StringObject() { string key = "kk"; object value = new object(); - var target = new DictionaryWrapper(new System.Collections.Hashtable()); - target.Add(key, value); - target.Add(key, value); + Assert.Throws(() => + { + var target = new DictionaryWrapper(new System.Collections.Hashtable()); + target.Add(key, value); + target.Add(key, value); + }); } - [TestMethod] + [Fact] public void GetValid_StringInt() { string key = "kk"; @@ -62,10 +66,10 @@ public void GetValid_StringInt() var target = new DictionaryWrapper(new System.Collections.Hashtable()); target.Add(key, value); var result = target[key]; - Assert.AreEqual(result, value); + Assert.Equal(result, value); } - [TestMethod] + [Fact] public void GetValid_StringObject() { string key = "kk"; @@ -73,27 +77,33 @@ public void GetValid_StringObject() var target = new DictionaryWrapper(new System.Collections.Hashtable()); target.Add(key, value); var result = target[key]; - Assert.AreSame(result, value); + Assert.Same(result, value); } - [TestMethod, ExpectedException(typeof(ArgumentException))] + [Fact] public void GetNoKey_StringInt() { string key = "kk"; int value = 42; var target = new DictionaryWrapper(new System.Collections.Hashtable()); target.Add(key, value); - var result = target["aa"]; + Assert.Throws(() => + { + var result = target["aa"]; + }); } - [TestMethod, ExpectedException(typeof(ArgumentException))] + [Fact] public void GetNoKey_StringObject() { string key = "kk"; object value = new object(); var target = new DictionaryWrapper(new System.Collections.Hashtable()); target.Add(key, value); - var result = target["aa"]; + Assert.Throws(() => + { + var result = target["aa"]; + }); } } } diff --git a/Sources/NET4.SrkToolkit.Common.Tests/DisaposableOnceTests.cs b/Sources/SrkToolkit.Common.FxUnitTests/DisaposableOnceTests.cs similarity index 74% rename from Sources/NET4.SrkToolkit.Common.Tests/DisaposableOnceTests.cs rename to Sources/SrkToolkit.Common.FxUnitTests/DisaposableOnceTests.cs index f9b5136..ba18ba8 100644 --- a/Sources/NET4.SrkToolkit.Common.Tests/DisaposableOnceTests.cs +++ b/Sources/SrkToolkit.Common.FxUnitTests/DisaposableOnceTests.cs @@ -5,13 +5,12 @@ namespace SrkToolkit.Common.Tests using System.Collections.Generic; using System.Linq; using System.Text; - using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Threading; + using Xunit; - [TestClass] public class DisaposableOnceTests { - [TestMethod] + [Fact] public void DelegateIsCalledOnceDispose() { // prepare @@ -22,10 +21,10 @@ public void DelegateIsCalledOnceDispose() target.Dispose(); // verify - Assert.AreEqual(1, disposed); + Assert.Equal(1, disposed); } - [TestMethod] + [Fact] public void GarbageCollectorDoesNotCallDelegate() { // prepare @@ -37,14 +36,14 @@ public void GarbageCollectorDoesNotCallDelegate() GC.WaitForPendingFinalizers(); // verify - Assert.IsFalse(target.IsAlive); - Assert.AreEqual(0, disposed); + Assert.False(target.IsAlive); + Assert.Equal(0, disposed); } /// /// Verify... /// - [TestMethod, ExpectedException(typeof(InvalidOperationException))] + [Fact] public void DisposeRethrowsOnDelegateInvocationException() { // prepare @@ -54,7 +53,10 @@ public void DisposeRethrowsOnDelegateInvocationException() }); // execute - target.Dispose(); + Assert.Throws(() => + { + target.Dispose(); + }); } } } diff --git a/Sources/NET4.SrkToolkit.Common.Tests/EmailAddressAttributeTests.cs b/Sources/SrkToolkit.Common.FxUnitTests/EmailAddressAttributeTests.cs similarity index 74% rename from Sources/NET4.SrkToolkit.Common.Tests/EmailAddressAttributeTests.cs rename to Sources/SrkToolkit.Common.FxUnitTests/EmailAddressAttributeTests.cs index 458fc6c..395635d 100644 --- a/Sources/NET4.SrkToolkit.Common.Tests/EmailAddressAttributeTests.cs +++ b/Sources/SrkToolkit.Common.FxUnitTests/EmailAddressAttributeTests.cs @@ -3,19 +3,19 @@ namespace SrkToolkit.Common.Tests { using System; using System.Collections.Generic; + using System.ComponentModel.DataAnnotations; + ////using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; - using Microsoft.VisualStudio.TestTools.UnitTesting; - using SrkToolkit.DataAnnotations; - using System.ComponentModel.DataAnnotations; + using Xunit; + using EmailAddressAttribute = SrkToolkit.DataAnnotations.EmailAddressAttribute; - [TestClass] +#if NETFRAMEWORK public class EmailAddressAttributeTests { - [TestClass] public class SingleValidation { - [TestMethod] + [Fact] public void NullValue_IsValid() { string value = null, name = "Email"; @@ -24,10 +24,10 @@ public void NullValue_IsValid() context.MemberName = name; var result = attr.GetValidationResult(value, context); - Assert.IsNull(result); + Assert.Null(result); } - [TestMethod] + [Fact] public void EmptyValue_IsValid() { string value = "", name = "Email"; @@ -36,10 +36,10 @@ public void EmptyValue_IsValid() context.MemberName = name; var result = attr.GetValidationResult(value, context); - Assert.IsNull(result); + Assert.Null(result); } - [TestMethod] + [Fact] public void InvalidAddress_IsInvalid() { string value = "test", name = "Email"; @@ -48,13 +48,13 @@ public void InvalidAddress_IsInvalid() context.MemberName = name; var result = attr.GetValidationResult(value, context); - Assert.IsNotNull(result); - Assert.AreEqual("A valid email address is required.", result.ErrorMessage); - Assert.AreEqual(1, result.MemberNames.Count()); - Assert.AreEqual(name, result.MemberNames.Single()); + Assert.NotNull(result); + Assert.Equal("A valid email address is required.", result.ErrorMessage); + Assert.Equal(1, result.MemberNames.Count()); + Assert.Equal(name, result.MemberNames.Single()); } - [TestMethod] + [Fact] public void ValidAddress_IsValid() { string value = "test@test.com", name = "Email"; @@ -63,10 +63,10 @@ public void ValidAddress_IsValid() context.MemberName = name; var result = attr.GetValidationResult(value, context); - Assert.IsNull(result); + Assert.Null(result); } - [TestMethod] + [Fact] public void ValidTagAddress_IsValid() { string value = "test+test@test.com", name = "Email"; @@ -75,10 +75,10 @@ public void ValidTagAddress_IsValid() context.MemberName = name; var result = attr.GetValidationResult(value, context); - Assert.IsNull(result); + Assert.Null(result); } - [TestMethod] + [Fact] public void ValidParisAddress_IsValid() { string value = "test@test.paris", name = "Email"; @@ -87,14 +87,13 @@ public void ValidParisAddress_IsValid() context.MemberName = name; var result = attr.GetValidationResult(value, context); - Assert.IsNull(result); + Assert.Null(result); } } - [TestClass] public class MultiValidation { - [TestMethod] + [Fact] public void NullValue_IsValid() { string value = null; @@ -104,11 +103,11 @@ public void NullValue_IsValid() }; var result = attr.GetIsValid(value, null); - Assert.IsNull(result); - //Assert.AreEqual(result.ErrorMessage, "A valid email address is required."); + Assert.Null(result); + //Assert.Equal(result.ErrorMessage, "A valid email address is required."); } - [TestMethod] + [Fact] public void EmptyValue_IsValid() { string value = ""; @@ -118,11 +117,11 @@ public void EmptyValue_IsValid() }; var result = attr.GetIsValid(value, null); - Assert.IsNull(result); - //Assert.AreEqual(result.ErrorMessage, "A valid email address is required."); + Assert.Null(result); + //Assert.Equal(result.ErrorMessage, "A valid email address is required."); } - [TestMethod] + [Fact] public void InvalidAddress_IsValid() { string value = "test"; @@ -132,10 +131,10 @@ public void InvalidAddress_IsValid() }; var result = attr.GetIsValid(value, null); - Assert.IsNull(result); + Assert.Null(result); } - [TestMethod] + [Fact] public void ValidAddress_IsValid() { string value = "test@test.com"; @@ -145,10 +144,10 @@ public void ValidAddress_IsValid() }; var result = attr.GetIsValid(value, null); - Assert.IsNull(result); + Assert.Null(result); } - [TestMethod] + [Fact] public void MultiValidAddress_IsValid() { string value = "test@test.com test@test.com test@test.com cool"; @@ -158,10 +157,10 @@ public void MultiValidAddress_IsValid() }; var result = attr.GetIsValid(value, null); - Assert.IsNull(result); + Assert.Null(result); } - [TestMethod] + [Fact] public void ValidTagAddress_IsValid() { string value = "test+test@test.com"; @@ -171,10 +170,10 @@ public void ValidTagAddress_IsValid() }; var result = attr.GetIsValid(value, null); - Assert.IsNull(result); + Assert.Null(result); } - [TestMethod] + [Fact] public void InvalidAddressAndMin1_IsInvalid() { string value = "test"; @@ -185,11 +184,11 @@ public void InvalidAddressAndMin1_IsInvalid() }; var result = attr.GetIsValid(value, null); - Assert.IsNotNull(result); - Assert.IsTrue(result.ErrorMessage.Contains("minimum of")); + Assert.NotNull(result); + Assert.True(result.ErrorMessage.Contains("minimum of")); } - [TestMethod] + [Fact] public void MultiValidAddressAndMax1_IsValid() { string value = "test@test.com test@test.com test@test.com cool"; @@ -200,9 +199,10 @@ public void MultiValidAddressAndMax1_IsValid() }; var result = attr.GetIsValid(value, null); - Assert.IsNotNull(result); - Assert.IsTrue(result.ErrorMessage.Contains("maximum of")); + Assert.NotNull(result); + Assert.True(result.ErrorMessage.Contains("maximum of")); } } } + #endif } diff --git a/Sources/NET4.SrkToolkit.Common.Tests/EmailAddressTests.cs b/Sources/SrkToolkit.Common.FxUnitTests/EmailAddressTests.cs similarity index 68% rename from Sources/NET4.SrkToolkit.Common.Tests/EmailAddressTests.cs rename to Sources/SrkToolkit.Common.FxUnitTests/EmailAddressTests.cs index b1306ca..ae4cef0 100644 --- a/Sources/NET4.SrkToolkit.Common.Tests/EmailAddressTests.cs +++ b/Sources/SrkToolkit.Common.FxUnitTests/EmailAddressTests.cs @@ -1,31 +1,36 @@  namespace SrkToolkit.Common.Tests { + using SrkToolkit.Common.Validation; using System; using System.Collections.Generic; using System.Linq; using System.Text; - using Microsoft.VisualStudio.TestTools.UnitTesting; - using SrkToolkit.Common.Validation; + using Xunit; public class EmailAddressTests { - [TestClass] public class Constructor1 { - [TestMethod, ExpectedException(typeof(ArgumentException))] + [Fact] public void NullAddress() { - var email = new EmailAddress(null); + Assert.Throws(() => + { + var email = new EmailAddress(null); + }); } - [TestMethod, ExpectedException(typeof(ArgumentException))] + [Fact] public void EmptyAddress() { - var email = new EmailAddress(" "); + Assert.Throws(() => + { + var email = new EmailAddress(" "); + }); } - [TestMethod] + [Fact] public void SplitsEmailInParts_NoTag() { // prepare @@ -39,14 +44,14 @@ public void SplitsEmailInParts_NoTag() var email = new EmailAddress(address); // verify - Assert.AreEqual(local, email.LocalPart); - Assert.AreEqual(user, email.AccountPart); - Assert.AreEqual(tag, email.TagPart); - Assert.AreEqual(domain, email.DomainPart); - Assert.AreEqual(address, email.Value); + Assert.Equal(local, email.LocalPart); + Assert.Equal(user, email.AccountPart); + Assert.Equal(tag, email.TagPart); + Assert.Equal(domain, email.DomainPart); + Assert.Equal(address, email.Value); } - [TestMethod] + [Fact] public void SplitsEmailInParts_WithTag() { // prepare @@ -60,14 +65,14 @@ public void SplitsEmailInParts_WithTag() var email = new EmailAddress(address); // verify - Assert.AreEqual(local, email.LocalPart); - Assert.AreEqual(user, email.AccountPart); - Assert.AreEqual(tag, email.TagPart); - Assert.AreEqual(domain, email.DomainPart); - Assert.AreEqual(address, email.Value); + Assert.Equal(local, email.LocalPart); + Assert.Equal(user, email.AccountPart); + Assert.Equal(tag, email.TagPart); + Assert.Equal(domain, email.DomainPart); + Assert.Equal(address, email.Value); } - [TestMethod] + [Fact] public void SplitsEmailInParts_MultiTag() { // prepare @@ -81,14 +86,14 @@ public void SplitsEmailInParts_MultiTag() var email = new EmailAddress(address); // verify - Assert.AreEqual(local, email.LocalPart); - Assert.AreEqual(user, email.AccountPart); - Assert.AreEqual(tag, email.TagPart); - Assert.AreEqual(domain, email.DomainPart); - Assert.AreEqual(address, email.Value); + Assert.Equal(local, email.LocalPart); + Assert.Equal(user, email.AccountPart); + Assert.Equal(tag, email.TagPart); + Assert.Equal(domain, email.DomainPart); + Assert.Equal(address, email.Value); } - [TestMethod] + [Fact] public void SplitsEmailInParts_EmptyTag() { // prepare @@ -102,18 +107,17 @@ public void SplitsEmailInParts_EmptyTag() var email = new EmailAddress(address); // verify - Assert.AreEqual(local, email.LocalPart); - Assert.AreEqual(user, email.AccountPart); - Assert.AreEqual(tag, email.TagPart); - Assert.AreEqual(domain, email.DomainPart); - Assert.AreEqual(address, email.Value); + Assert.Equal(local, email.LocalPart); + Assert.Equal(user, email.AccountPart); + Assert.Equal(tag, email.TagPart); + Assert.Equal(domain, email.DomainPart); + Assert.Equal(address, email.Value); } } - [TestClass] public class Constructor2 { - [TestMethod, ExpectedException(typeof(ArgumentException))] + [Fact] public void NullAccountPart() { // prepare @@ -124,10 +128,13 @@ public void NullAccountPart() string address = local + "@" + domain; // execute - var email = new EmailAddress(address); + Assert.Throws(() => + { + var email = new EmailAddress(address); + }); } - [TestMethod, ExpectedException(typeof(ArgumentException))] + [Fact] public void EmptyAccountPart() { // prepare @@ -138,10 +145,13 @@ public void EmptyAccountPart() string address = local + "@" + domain; // execute - var email = new EmailAddress(address); + Assert.Throws(() => + { + var email = new EmailAddress(address); + }); } - [TestMethod, ExpectedException(typeof(ArgumentException))] + [Fact] public void NullDomainPart() { // prepare @@ -152,10 +162,13 @@ public void NullDomainPart() string address = local + "@" + domain; // execute - var email = new EmailAddress(address); + Assert.Throws(() => + { + var email = new EmailAddress(address); + }); } - [TestMethod, ExpectedException(typeof(ArgumentException))] + [Fact] public void EmptyDomainPart() { // prepare @@ -166,10 +179,13 @@ public void EmptyDomainPart() string address = local + "@" + domain; // execute - var email = new EmailAddress(address); + Assert.Throws(() => + { + var email = new EmailAddress(address); + }); } - [TestMethod] + [Fact] public void SplitsEmailInParts_NoTag() { // prepare @@ -183,14 +199,14 @@ public void SplitsEmailInParts_NoTag() var email = new EmailAddress(user, tag, domain); // verify - Assert.AreEqual(local, email.LocalPart); - Assert.AreEqual(user, email.AccountPart); - Assert.AreEqual(tag, email.TagPart); - Assert.AreEqual(domain, email.DomainPart); - Assert.AreEqual(address, email.Value); + Assert.Equal(local, email.LocalPart); + Assert.Equal(user, email.AccountPart); + Assert.Equal(tag, email.TagPart); + Assert.Equal(domain, email.DomainPart); + Assert.Equal(address, email.Value); } - [TestMethod] + [Fact] public void SplitsEmailInParts_WithTag() { // prepare @@ -204,14 +220,14 @@ public void SplitsEmailInParts_WithTag() var email = new EmailAddress(user, tag, domain); // verify - Assert.AreEqual(local, email.LocalPart); - Assert.AreEqual(user, email.AccountPart); - Assert.AreEqual(tag, email.TagPart); - Assert.AreEqual(domain, email.DomainPart); - Assert.AreEqual(address, email.Value); + Assert.Equal(local, email.LocalPart); + Assert.Equal(user, email.AccountPart); + Assert.Equal(tag, email.TagPart); + Assert.Equal(domain, email.DomainPart); + Assert.Equal(address, email.Value); } - [TestMethod] + [Fact] public void SplitsEmailInParts_MultiTag() { // prepare @@ -225,14 +241,14 @@ public void SplitsEmailInParts_MultiTag() var email = new EmailAddress(user, tag, domain); // verify - Assert.AreEqual(local, email.LocalPart); - Assert.AreEqual(user, email.AccountPart); - Assert.AreEqual(tag, email.TagPart); - Assert.AreEqual(domain, email.DomainPart); - Assert.AreEqual(address, email.Value); + Assert.Equal(local, email.LocalPart); + Assert.Equal(user, email.AccountPart); + Assert.Equal(tag, email.TagPart); + Assert.Equal(domain, email.DomainPart); + Assert.Equal(address, email.Value); } - [TestMethod] + [Fact] public void SplitsEmailInParts_EmptyTag() { // prepare @@ -246,14 +262,14 @@ public void SplitsEmailInParts_EmptyTag() var email = new EmailAddress(user, tag, domain); // verify - Assert.AreEqual(local, email.LocalPart); - Assert.AreEqual(user, email.AccountPart); - Assert.AreEqual(null, email.TagPart); - Assert.AreEqual(domain, email.DomainPart); - Assert.AreEqual(address, email.Value); + Assert.Equal(local, email.LocalPart); + Assert.Equal(user, email.AccountPart); + Assert.Equal(null, email.TagPart); + Assert.Equal(domain, email.DomainPart); + Assert.Equal(address, email.Value); } - [TestMethod] + [Fact] public void SplitsEmailInParts_EmptyTag_SingleQuote() { // prepare @@ -267,18 +283,17 @@ public void SplitsEmailInParts_EmptyTag_SingleQuote() var email = new EmailAddress(user, tag, domain); // verify - Assert.AreEqual(local, email.LocalPart); - Assert.AreEqual(user, email.AccountPart); - Assert.AreEqual(null, email.TagPart); - Assert.AreEqual(domain, email.DomainPart); - Assert.AreEqual(address, email.Value); + Assert.Equal(local, email.LocalPart); + Assert.Equal(user, email.AccountPart); + Assert.Equal(null, email.TagPart); + Assert.Equal(domain, email.DomainPart); + Assert.Equal(address, email.Value); } } - [TestClass] public class ValueWithoutTagGetter { - [TestMethod] + [Fact] public void WorksWithNoTag() { // prepare @@ -289,10 +304,10 @@ public void WorksWithNoTag() var email = new EmailAddress(input); // verify - Assert.AreEqual(expected, email.ValueWithoutTag); + Assert.Equal(expected, email.ValueWithoutTag); } - [TestMethod] + [Fact] public void WorksWithOneTag() { // prepare @@ -303,167 +318,163 @@ public void WorksWithOneTag() var email = new EmailAddress(input); // verify - Assert.AreEqual(expected, email.ValueWithoutTag); + Assert.Equal(expected, email.ValueWithoutTag); } } - [TestClass] public class ObjectEqualsMethod { - [TestMethod] + [Fact] public void ObjectEqual_AgainstNull() { EmailAddress value1 = new EmailAddress("test@est.com"); EmailAddress value2 = null; var result = value1.Equals((object)value2); - Assert.IsFalse(result); + Assert.False(result); } - [TestMethod] + [Fact] public void ObjectEqual_AgainstSameReference() { EmailAddress value1 = new EmailAddress("test@est.com"); EmailAddress value2 = value1; var result = value1.Equals((object)value2); - Assert.IsTrue(result); + Assert.True(result); } - [TestMethod] + [Fact] public void ObjectEqual_AgainstSameValue() { EmailAddress value1 = new EmailAddress("test@est.com"); EmailAddress value2 = new EmailAddress("test@est.com"); var result = value1.Equals((object)value2); - Assert.IsTrue(result); + Assert.True(result); } - [TestMethod] + [Fact] public void ObjectEqual_AgainstDifferentValue() { EmailAddress value1 = new EmailAddress("test@est.com"); EmailAddress value2 = new EmailAddress("lalala@test.com"); var result = value1.Equals((object)value2); - Assert.IsFalse(result); + Assert.False(result); } } - [TestClass] public class EmailAddressEqualsMethod { - [TestMethod] + [Fact] public void ObjectEqual_AgainstNull() { EmailAddress value1 = new EmailAddress("test@est.com"); EmailAddress value2 = null; var result = value1.Equals(value2); - Assert.IsFalse(result); + Assert.False(result); } - [TestMethod] + [Fact] public void ObjectEqual_AgainstSameReference() { EmailAddress value1 = new EmailAddress("test@est.com"); EmailAddress value2 = value1; var result = value1.Equals(value2); - Assert.IsTrue(result); + Assert.True(result); } - [TestMethod] + [Fact] public void ObjectEqual_AgainstSameValue() { EmailAddress value1 = new EmailAddress("test@est.com"); EmailAddress value2 = new EmailAddress("test@est.com"); var result = value1.Equals(value2); - Assert.IsTrue(result); + Assert.True(result); } - [TestMethod] + [Fact] public void ObjectEqual_AgainstDifferentValue() { EmailAddress value1 = new EmailAddress("test@est.com"); EmailAddress value2 = new EmailAddress("lalala@test.com"); var result = value1.Equals(value2); - Assert.IsFalse(result); + Assert.False(result); } } - [TestClass] public class OperatorEqualsMethod { - [TestMethod] + [Fact] public void EqualityOperator_AgainstNull() { EmailAddress value1 = new EmailAddress("test@est.com"); EmailAddress value2 = null; var result = value1 == value2; - Assert.IsFalse(result); + Assert.False(result); } - [TestMethod] + [Fact] public void EqualityOperator_AgainstSameReference() { EmailAddress value1 = new EmailAddress("test@est.com"); EmailAddress value2 = value1; var result = value1 == value2; - Assert.IsTrue(result); + Assert.True(result); } - [TestMethod] + [Fact] public void EqualityOperator_AgainstSameValue() { EmailAddress value1 = new EmailAddress("test@est.com"); EmailAddress value2 = new EmailAddress("test@est.com"); var result = value1 == value2; - Assert.IsTrue(result); + Assert.True(result); } - [TestMethod] + [Fact] public void EqualityOperator_AgainstDifferentValue() { EmailAddress value1 = new EmailAddress("test@est.com"); EmailAddress value2 = new EmailAddress("lalala@test.com"); var result = value1 == value2; - Assert.IsFalse(result); + Assert.False(result); } } - [TestClass] public class OperatorInEqualsMethod { - [TestMethod] + [Fact] public void InequalityOperator_AgainstNull() { EmailAddress value1 = new EmailAddress("test@est.com"); EmailAddress value2 = null; var result = value1 != value2; - Assert.IsTrue(result); + Assert.True(result); } - [TestMethod] + [Fact] public void InequalityOperator_AgainstSameReference() { EmailAddress value1 = new EmailAddress("test@est.com"); EmailAddress value2 = value1; var result = value1 != value2; - Assert.IsFalse(result); + Assert.False(result); } - [TestMethod] + [Fact] public void InequalityOperator_AgainstSameValue() { EmailAddress value1 = new EmailAddress("test@est.com"); EmailAddress value2 = new EmailAddress("test@est.com"); var result = value1 != value2; - Assert.IsFalse(result); + Assert.False(result); } - [TestMethod] + [Fact] public void InequalityOperator_AgainstDifferentValue() { EmailAddress value1 = new EmailAddress("test@est.com"); EmailAddress value2 = new EmailAddress("lalala@test.com"); var result = value1 != value2; - Assert.IsTrue(result); + Assert.True(result); } } } diff --git a/Sources/NET4.SrkToolkit.Common.Tests/EnumStrings.Designer.cs b/Sources/SrkToolkit.Common.FxUnitTests/EnumStrings.Designer.cs similarity index 95% rename from Sources/NET4.SrkToolkit.Common.Tests/EnumStrings.Designer.cs rename to Sources/SrkToolkit.Common.FxUnitTests/EnumStrings.Designer.cs index 5f09375..330fb3a 100644 --- a/Sources/NET4.SrkToolkit.Common.Tests/EnumStrings.Designer.cs +++ b/Sources/SrkToolkit.Common.FxUnitTests/EnumStrings.Designer.cs @@ -1,7 +1,6 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.18444 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -39,7 +38,7 @@ internal EnumStrings() { public static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SrkToolkit.Common.Tests.EnumStrings", typeof(EnumStrings).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SrkToolkit.Common.CoreUnitTests.EnumStrings", typeof(EnumStrings).Assembly); resourceMan = temp; } return resourceMan; diff --git a/Sources/NET4.SrkToolkit.Common.Tests/EnumStrings.fr.resx b/Sources/SrkToolkit.Common.FxUnitTests/EnumStrings.fr.resx similarity index 100% rename from Sources/NET4.SrkToolkit.Common.Tests/EnumStrings.fr.resx rename to Sources/SrkToolkit.Common.FxUnitTests/EnumStrings.fr.resx diff --git a/Sources/NET4.SrkToolkit.Common.Tests/EnumStrings.resx b/Sources/SrkToolkit.Common.FxUnitTests/EnumStrings.resx similarity index 100% rename from Sources/NET4.SrkToolkit.Common.Tests/EnumStrings.resx rename to Sources/SrkToolkit.Common.FxUnitTests/EnumStrings.resx diff --git a/Sources/NET4.SrkToolkit.Common.Tests/EnumToolsTests.cs b/Sources/SrkToolkit.Common.FxUnitTests/EnumToolsTests.cs similarity index 78% rename from Sources/NET4.SrkToolkit.Common.Tests/EnumToolsTests.cs rename to Sources/SrkToolkit.Common.FxUnitTests/EnumToolsTests.cs index 3b8b23a..ada6c13 100644 --- a/Sources/NET4.SrkToolkit.Common.Tests/EnumToolsTests.cs +++ b/Sources/SrkToolkit.Common.FxUnitTests/EnumToolsTests.cs @@ -5,20 +5,18 @@ namespace SrkToolkit.Common.Tests using System.Collections.Generic; using System.Linq; using System.Text; - using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Threading; using System.Globalization; + using Xunit; - [TestClass] public class EnumToolsTests { private static CultureInfo defaultCulture = new CultureInfo("en-US"); private static CultureInfo frenchCulture = new CultureInfo("fr-FR"); - [TestClass] public class GetDescription { - [TestMethod] + [Fact] public void HasDescription_ThreadCulture_AssembliesCulture() { Thread.CurrentThread.CurrentUICulture = defaultCulture; @@ -30,10 +28,10 @@ public void HasDescription_ThreadCulture_AssembliesCulture() var desc = EnumTools.GetDescription(value, EnumStrings.ResourceManager); // verify - Assert.AreEqual("Description of SuperEnum.Two", desc); + Assert.Equal("Description of SuperEnum.Two", desc); } - [TestMethod] + [Fact] public void NoDescription_ThreadCulture_AssembliesCulture() { Thread.CurrentThread.CurrentUICulture = defaultCulture; @@ -45,10 +43,10 @@ public void NoDescription_ThreadCulture_AssembliesCulture() var desc = EnumTools.GetDescription(value, EnumStrings.ResourceManager); // verify - Assert.AreEqual("Three", desc); + Assert.Equal("Three", desc); } - [TestMethod] + [Fact] public void HasDescription_SpecifiedCulture_AssembliesCulture() { Thread.CurrentThread.CurrentUICulture = frenchCulture; @@ -60,10 +58,10 @@ public void HasDescription_SpecifiedCulture_AssembliesCulture() var desc = EnumTools.GetDescription(value, EnumStrings.ResourceManager, defaultCulture); // verify - Assert.AreEqual("Description of SuperEnum.Two", desc); + Assert.Equal("Description of SuperEnum.Two", desc); } - [TestMethod] + [Fact] public void NoDescription_SpecifiedCulture_AssembliesCulture() { Thread.CurrentThread.CurrentUICulture = frenchCulture; @@ -75,10 +73,10 @@ public void NoDescription_SpecifiedCulture_AssembliesCulture() var desc = EnumTools.GetDescription(value, EnumStrings.ResourceManager, defaultCulture); // verify - Assert.AreEqual("Three", desc); + Assert.Equal("Three", desc); } - [TestMethod] + [Fact] public void HasDescription_ThreadCulture_FrenchCulture() { Thread.CurrentThread.CurrentUICulture = frenchCulture; @@ -90,10 +88,10 @@ public void HasDescription_ThreadCulture_FrenchCulture() var desc = EnumTools.GetDescription(value, EnumStrings.ResourceManager); // verify - Assert.AreEqual("Description de SuperEnum.Two", desc); + Assert.Equal("Description de SuperEnum.Two", desc); } - [TestMethod] + [Fact] public void NoDescription_ThreadCulture_FrenchCulture() { Thread.CurrentThread.CurrentUICulture = frenchCulture; @@ -105,10 +103,10 @@ public void NoDescription_ThreadCulture_FrenchCulture() var desc = EnumTools.GetDescription(value, EnumStrings.ResourceManager); // verify - Assert.AreEqual("Three", desc); + Assert.Equal("Three", desc); } - [TestMethod] + [Fact] public void HasDescription_SpecifiedCulture_FrenchCulture() { Thread.CurrentThread.CurrentUICulture = defaultCulture; @@ -120,10 +118,10 @@ public void HasDescription_SpecifiedCulture_FrenchCulture() var desc = EnumTools.GetDescription(value, EnumStrings.ResourceManager, frenchCulture); // verify - Assert.AreEqual("Description de SuperEnum.Two", desc); + Assert.Equal("Description de SuperEnum.Two", desc); } - [TestMethod] + [Fact] public void NoDescription_SpecifiedCulture_FrenchCulture() { Thread.CurrentThread.CurrentUICulture = defaultCulture; @@ -135,10 +133,10 @@ public void NoDescription_SpecifiedCulture_FrenchCulture() var desc = EnumTools.GetDescription(value, EnumStrings.ResourceManager, frenchCulture); // verify - Assert.AreEqual("Three", desc); + Assert.Equal("Three", desc); } - [TestMethod] + [Fact] public void HasDescription_ThreadCulture_AssembliesCulture_Suffix() { Thread.CurrentThread.CurrentUICulture = defaultCulture; @@ -150,10 +148,10 @@ public void HasDescription_ThreadCulture_AssembliesCulture_Suffix() var desc = EnumTools.GetDescription(value, EnumStrings.ResourceManager, null, "_Desc"); // verify - Assert.AreEqual("Super long description of the SuperEnum.Two enum value. lalalalala allalalal alallalalal alal allaall allalallalala.", desc); + Assert.Equal("Super long description of the SuperEnum.Two enum value. lalalalala allalalal alallalalal alal allaall allalallalala.", desc); } - [TestMethod] + [Fact] public void HasDescription_ThreadCulture_AssembliesCulture_Prefix() { Thread.CurrentThread.CurrentUICulture = defaultCulture; @@ -165,7 +163,7 @@ public void HasDescription_ThreadCulture_AssembliesCulture_Prefix() var desc = EnumTools.GetDescription(value, EnumStrings.ResourceManager, "Def_", null); // verify - Assert.AreEqual("Description of SuperEnum.Two blah", desc); + Assert.Equal("Description of SuperEnum.Two blah", desc); } } diff --git a/Sources/NET4.SrkToolkit.Common.Tests/ObservableCollectionExtensionsTests.cs b/Sources/SrkToolkit.Common.FxUnitTests/ObservableCollectionExtensionsTests.cs similarity index 66% rename from Sources/NET4.SrkToolkit.Common.Tests/ObservableCollectionExtensionsTests.cs rename to Sources/SrkToolkit.Common.FxUnitTests/ObservableCollectionExtensionsTests.cs index 1feaf12..651d98b 100644 --- a/Sources/NET4.SrkToolkit.Common.Tests/ObservableCollectionExtensionsTests.cs +++ b/Sources/SrkToolkit.Common.FxUnitTests/ObservableCollectionExtensionsTests.cs @@ -8,29 +8,34 @@ namespace SrkToolkit.Common.Tests { using System; using System.Collections.Generic; + using System.Collections.ObjectModel; using System.Linq; using System.Text; - using Microsoft.VisualStudio.TestTools.UnitTesting; - using System.Collections.ObjectModel; + using Xunit; public class ObservableCollectionExtensionsTests { - [TestClass] public class AddRangeMethod { - [TestMethod, ExpectedException(typeof(ArgumentNullException))] + [Fact] public void ThrowsWhenArg0IsNull() { - SrkObservableCollectionExtensions.AddRange(null, new string[0]); + Assert.Throws(() => + { + SrkObservableCollectionExtensions.AddRange(null, new string[0]); + }); } - [TestMethod, ExpectedException(typeof(ArgumentNullException))] + [Fact] public void ThrowsWhenArg1IsNull() { - SrkObservableCollectionExtensions.AddRange(new ObservableCollection(), null); + Assert.Throws(() => + { + SrkObservableCollectionExtensions.AddRange(new ObservableCollection(), null); + }); } - [TestMethod] + [Fact] public void CorrectlyAddsElements() { var target = new ObservableCollection(); @@ -38,10 +43,10 @@ public void CorrectlyAddsElements() SrkObservableCollectionExtensions.AddRange(target, elements); - Assert.AreEqual(2, target.Count); + Assert.Equal(2, target.Count); } - [TestMethod] + [Fact] public void ReturnsSelf() { var target = new ObservableCollection(); @@ -49,26 +54,31 @@ public void ReturnsSelf() var result = SrkObservableCollectionExtensions.AddRange(target, elements); - Assert.AreEqual(target, result); + Assert.Equal(target, result); } } - [TestClass] public class RemoveAllMethod { - [TestMethod, ExpectedException(typeof(ArgumentNullException))] + [Fact] public void ThrowsWhenArg0IsNull() { - SrkObservableCollectionExtensions.RemoveAll(null, s => true); + Assert.Throws(() => + { + SrkObservableCollectionExtensions.RemoveAll(null, s => true); + }); } - [TestMethod, ExpectedException(typeof(ArgumentNullException))] + [Fact] public void ThrowsWhenArg1IsNull() { - SrkObservableCollectionExtensions.RemoveAll(new ObservableCollection(), null); + Assert.Throws(() => + { + SrkObservableCollectionExtensions.RemoveAll(new ObservableCollection(), null); + }); } - [TestMethod] + [Fact] public void RemovesElements() { var elements = new string[] { "a", "b", "c", }; @@ -77,10 +87,10 @@ public void RemovesElements() SrkObservableCollectionExtensions.RemoveAll(target, predicate); - Assert.AreEqual(2, target.Count); + Assert.Equal(2, target.Count); } - [TestMethod] + [Fact] public void RemovesSameElements() { var elements = new string[] { "a", "b", "b", "c", }; @@ -89,10 +99,10 @@ public void RemovesSameElements() SrkObservableCollectionExtensions.RemoveAll(target, predicate); - Assert.AreEqual(2, target.Count); + Assert.Equal(2, target.Count); } - [TestMethod] + [Fact] public void ReturnsSelf() { var elements = new string[] { "a", "b", "c", }; @@ -101,7 +111,7 @@ public void ReturnsSelf() var result = SrkObservableCollectionExtensions.RemoveAll(target, predicate); - Assert.AreEqual(target, result); + Assert.Equal(target, result); } } } diff --git a/Sources/SrkToolkit.Common.FxUnitTests/Properties/AssemblyInfo.cs b/Sources/SrkToolkit.Common.FxUnitTests/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..823a4a2 --- /dev/null +++ b/Sources/SrkToolkit.Common.FxUnitTests/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("SrkToolkit.Common.FxUnitTests")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("SrkToolkit.Common.FxUnitTests")] +[assembly: AssemblyCopyright("Copyright © 2023")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("00457CE3-FE08-4AF2-972E-4C2EDD36F38D")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Sources/NET4.SrkToolkit.Common.Tests/RetryLogicTests.NET4.cs b/Sources/SrkToolkit.Common.FxUnitTests/RetryLogicTests.NET4.cs similarity index 96% rename from Sources/NET4.SrkToolkit.Common.Tests/RetryLogicTests.NET4.cs rename to Sources/SrkToolkit.Common.FxUnitTests/RetryLogicTests.NET4.cs index b0f3625..ddcd468 100644 --- a/Sources/NET4.SrkToolkit.Common.Tests/RetryLogicTests.NET4.cs +++ b/Sources/SrkToolkit.Common.FxUnitTests/RetryLogicTests.NET4.cs @@ -16,17 +16,16 @@ namespace SrkToolkit.Common.Tests { - using Microsoft.VisualStudio.TestTools.UnitTesting; using Should; using System; using System.Diagnostics; using System.IO; using System.Threading.Tasks; + using Xunit; - [TestClass] public partial class RetryLogicTests { - [TestMethod] + [Fact] public void Action_Should_Be_Tried_3Times_With_ProgressiveInterval() { var exceptionCount = 0; @@ -56,7 +55,7 @@ public void Action_Should_Be_Tried_3Times_With_ProgressiveInterval() successCount.ShouldEqual(0); } - [TestMethod] + [Fact] public void Function_Should_Be_Tried_3Times_With_ExponentialInterval() { var exceptionCount = 0; @@ -86,7 +85,7 @@ public void Function_Should_Be_Tried_3Times_With_ExponentialInterval() successCount.ShouldEqual(0); } - [TestMethod] + [Fact] public void Function_Should_Be_A_Success() { var exceptionCount = 0; @@ -115,7 +114,7 @@ public void Function_Should_Be_A_Success() successCount.ShouldEqual(1); } - [TestMethod] + [Fact] public void Action_Should_Be_A_Success() { var exceptionCount = 0; diff --git a/Sources/NET4.SrkToolkit.Common.Tests/SrkArrayExtensionsTests.cs b/Sources/SrkToolkit.Common.FxUnitTests/SrkArrayExtensionsTests.cs similarity index 51% rename from Sources/NET4.SrkToolkit.Common.Tests/SrkArrayExtensionsTests.cs rename to Sources/SrkToolkit.Common.FxUnitTests/SrkArrayExtensionsTests.cs index 7242a3e..ce90c15 100644 --- a/Sources/NET4.SrkToolkit.Common.Tests/SrkArrayExtensionsTests.cs +++ b/Sources/SrkToolkit.Common.FxUnitTests/SrkArrayExtensionsTests.cs @@ -1,156 +1,162 @@  namespace SrkToolkit.Common.Tests { - using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; using System.Linq; using System.Text; + using Xunit; - [TestClass] public class SrkArrayExtensionsTests { - [TestClass] public class CombineWithMethod_CombineArray { - [TestMethod, ExpectedException(typeof(ArgumentNullException))] + [Fact] public void ThrowsArg0Null() { - SrkArrayExtensions.CombineWith(default(string[]), new string[0]); + Assert.Throws(() => + { + SrkArrayExtensions.CombineWith(default(string[]), new string[0]); + }); } - [TestMethod, ExpectedException(typeof(ArgumentNullException))] + [Fact] public void ThrowsArg1Null() { - SrkArrayExtensions.CombineWith(new string[0], default(string[])); + Assert.Throws(() => + { + SrkArrayExtensions.CombineWith(new string[0], default(string[])); + }); } - [TestMethod] + [Fact] public void Works1() { var source = new int[] { 1, 2, }; var items = new int[] { 3, 4, }; var result = SrkArrayExtensions.CombineWith(source, items); - Assert.AreEqual(4, result.Length); - Assert.AreEqual(1, result[0]); - Assert.AreEqual(2, result[1]); - Assert.AreEqual(3, result[2]); - Assert.AreEqual(4, result[3]); + Assert.Equal(4, result.Length); + Assert.Equal(1, result[0]); + Assert.Equal(2, result[1]); + Assert.Equal(3, result[2]); + Assert.Equal(4, result[3]); } - [TestMethod] + [Fact] public void Works2() { var source = new int[] { 1, 2, }; var items1 = new int[] { 3, 4, }; var items2 = new int[] { 5, 6, }; var result = SrkArrayExtensions.CombineWith(source, items1, items2); - Assert.AreEqual(6, result.Length); - Assert.AreEqual(1, result[0]); - Assert.AreEqual(2, result[1]); - Assert.AreEqual(3, result[2]); - Assert.AreEqual(4, result[3]); - Assert.AreEqual(5, result[4]); - Assert.AreEqual(6, result[5]); + Assert.Equal(6, result.Length); + Assert.Equal(1, result[0]); + Assert.Equal(2, result[1]); + Assert.Equal(3, result[2]); + Assert.Equal(4, result[3]); + Assert.Equal(5, result[4]); + Assert.Equal(6, result[5]); } - [TestMethod] + [Fact] public void EmptyArg0() { var source = new int[] { }; var items = new int[] { 3, 4, }; var result = SrkArrayExtensions.CombineWith(source, items); - Assert.AreEqual(2, result.Length); - Assert.AreEqual(3, result[0]); - Assert.AreEqual(4, result[1]); + Assert.Equal(2, result.Length); + Assert.Equal(3, result[0]); + Assert.Equal(4, result[1]); } - [TestMethod] + [Fact] public void EmptyArg1() { var source = new int[] { 1, 2, }; var items = new int[] { }; var result = SrkArrayExtensions.CombineWith(source, items); - Assert.AreEqual(2, result.Length); - Assert.AreEqual(1, result[0]); - Assert.AreEqual(2, result[1]); + Assert.Equal(2, result.Length); + Assert.Equal(1, result[0]); + Assert.Equal(2, result[1]); } - [TestMethod] + [Fact] public void EmptyArgs() { var source = new int[] { }; var items = new int[] { }; var result = SrkArrayExtensions.CombineWith(source, items); - Assert.AreEqual(0, result.Length); + Assert.Equal(0, result.Length); } } - [TestClass] public class CombineWithMethod_CombineItem { - [TestMethod, ExpectedException(typeof(ArgumentNullException))] + [Fact] public void ThrowsArg0Null() { - SrkArrayExtensions.CombineWith(default(string[]), string.Empty); + Assert.Throws(() => + { + SrkArrayExtensions.CombineWith(default(string[]), string.Empty); + }); } - [TestMethod] + [Fact] public void Works1() { var source = new int[] { 1, 2, }; var item = 3; var result = SrkArrayExtensions.CombineWith(source, item); - Assert.AreEqual(3, result.Length); - Assert.AreEqual(1, result[0]); - Assert.AreEqual(2, result[1]); - Assert.AreEqual(3, result[2]); + Assert.Equal(3, result.Length); + Assert.Equal(1, result[0]); + Assert.Equal(2, result[1]); + Assert.Equal(3, result[2]); } - [TestMethod] + [Fact] public void Works2() { var source = new int[] { 1, 2, }; var item1 = 3; var item2 = 4; var result = SrkArrayExtensions.CombineWith(source, item1, item2); - Assert.AreEqual(4, result.Length); - Assert.AreEqual(1, result[0]); - Assert.AreEqual(2, result[1]); - Assert.AreEqual(3, result[2]); - Assert.AreEqual(4, result[3]); + Assert.Equal(4, result.Length); + Assert.Equal(1, result[0]); + Assert.Equal(2, result[1]); + Assert.Equal(3, result[2]); + Assert.Equal(4, result[3]); } - [TestMethod] + [Fact] public void EmptyArg0() { var source = new int[] { }; var item = 3; var result = SrkArrayExtensions.CombineWith(source, item); - Assert.AreEqual(1, result.Length); - Assert.AreEqual(3, result[0]); + Assert.Equal(1, result.Length); + Assert.Equal(3, result[0]); } - [TestMethod] + [Fact] public void EmptyArg1() { var source = new string[] { "1", "2", }; string item = null; var result = SrkArrayExtensions.CombineWith(source, item); - Assert.AreEqual(3, result.Length); - Assert.AreEqual("1", result[0]); - Assert.AreEqual("2", result[1]); - Assert.AreEqual(item, result[2]); + Assert.Equal(3, result.Length); + Assert.Equal("1", result[0]); + Assert.Equal("2", result[1]); + Assert.Equal(item, result[2]); } - [TestMethod] + [Fact] public void EmptyArgs() { var source = new string[] { }; var item = default(string); var result = SrkArrayExtensions.CombineWith(source, item); - Assert.AreEqual(1, result.Length); - Assert.AreEqual(item, result[0]); + Assert.Equal(1, result.Length); + Assert.Equal(item, result[0]); } } } diff --git a/Sources/SrkToolkit.Common.FxUnitTests/SrkDateTimeExtensionsTests.cs b/Sources/SrkToolkit.Common.FxUnitTests/SrkDateTimeExtensionsTests.cs new file mode 100644 index 0000000..2f535f6 --- /dev/null +++ b/Sources/SrkToolkit.Common.FxUnitTests/SrkDateTimeExtensionsTests.cs @@ -0,0 +1,356 @@ +// ----------------------------------------------------------------------- +// +// TODO: Update copyright text. +// +// ----------------------------------------------------------------------- + +namespace SrkToolkit.Common.Tests +{ + using System; + using System.Collections.Generic; + using System.Linq; + using System.Text; + using Xunit; + + public class SrkDateTimeExtensionsTests + { + public class GetDateMethod + { + [Fact] + public void WorksForNow() + { + var date = DateTime.Now; + + var result = date.GetDate(); + + Assert.Equal(date.Year, result.Year); + Assert.Equal(date.Month, result.Month); + Assert.Equal(date.Day, result.Day); + Assert.Equal(0, result.Hour); + Assert.Equal(0, result.Minute); + Assert.Equal(0, result.Second); + Assert.Equal(0, result.Millisecond); + Assert.Equal(date.Kind, result.Kind); + } + + [Fact] + public void WorksForUtcNow() + { + var date = DateTime.UtcNow; + + var result = date.GetDate(); + + Assert.Equal(date.Year, result.Year); + Assert.Equal(date.Month, result.Month); + Assert.Equal(date.Day, result.Day); + Assert.Equal(0, result.Hour); + Assert.Equal(0, result.Minute); + Assert.Equal(0, result.Second); + Assert.Equal(0, result.Millisecond); + Assert.Equal(date.Kind, result.Kind); + } + + [Fact] + public void Works1() + { + var date = new DateTime(1987, 6, 5, 4, 3, 2, 111, DateTimeKind.Unspecified); + + var result = date.GetDate(); + + Assert.Equal(date.Year, result.Year); + Assert.Equal(date.Month, result.Month); + Assert.Equal(date.Day, result.Day); + Assert.Equal(0, result.Hour); + Assert.Equal(0, result.Minute); + Assert.Equal(0, result.Second); + Assert.Equal(0, result.Millisecond); + Assert.Equal(date.Kind, result.Kind); + } + } + + public class ToPrecisionMethod + { + [Fact] + public void ToMillisecond() + { + var date = new DateTime(1987, 6, 5, 4, 3, 2, 1, DateTimeKind.Utc); + var result = date.ToPrecision(DateTimePrecision.Millisecond); + + Assert.Equal(date.Year, result.Year); + Assert.Equal(date.Month, result.Month); + Assert.Equal(date.Day, result.Day); + Assert.Equal(date.Hour, result.Hour); + Assert.Equal(date.Minute, result.Minute); + Assert.Equal(date.Second, result.Second); + Assert.Equal(date.Millisecond, result.Millisecond); + Assert.Equal(date.Kind, result.Kind); + } + + [Fact] + public void ToSecond() + { + var date = new DateTime(1987, 6, 5, 4, 3, 2, 1, DateTimeKind.Utc); + var result = date.ToPrecision(DateTimePrecision.Second); + + Assert.Equal(date.Year, result.Year); + Assert.Equal(date.Month, result.Month); + Assert.Equal(date.Day, result.Day); + Assert.Equal(date.Hour, result.Hour); + Assert.Equal(date.Minute, result.Minute); + Assert.Equal(date.Second, result.Second); + Assert.Equal(0, result.Millisecond); + Assert.Equal(date.Kind, result.Kind); + } + + [Fact] + public void ToMinute() + { + var date = new DateTime(1987, 6, 5, 4, 3, 2, 1, DateTimeKind.Utc); + var result = date.ToPrecision(DateTimePrecision.Minute); + + Assert.Equal(date.Year, result.Year); + Assert.Equal(date.Month, result.Month); + Assert.Equal(date.Day, result.Day); + Assert.Equal(date.Hour, result.Hour); + Assert.Equal(date.Minute, result.Minute); + Assert.Equal(0, result.Second); + Assert.Equal(0, result.Millisecond); + Assert.Equal(date.Kind, result.Kind); + } + + [Fact] + public void ToHour() + { + var date = new DateTime(1987, 6, 5, 4, 3, 2, 1, DateTimeKind.Utc); + var result = date.ToPrecision(DateTimePrecision.Hour); + + Assert.Equal(date.Year, result.Year); + Assert.Equal(date.Month, result.Month); + Assert.Equal(date.Day, result.Day); + Assert.Equal(date.Hour, result.Hour); + Assert.Equal(0, result.Minute); + Assert.Equal(0, result.Second); + Assert.Equal(0, result.Millisecond); + Assert.Equal(date.Kind, result.Kind); + } + + [Fact] + public void ToDay() + { + var date = new DateTime(1987, 6, 5, 4, 3, 2, 1, DateTimeKind.Utc); + var result = date.ToPrecision(DateTimePrecision.Day); + + Assert.Equal(date.Year, result.Year); + Assert.Equal(date.Month, result.Month); + Assert.Equal(date.Day, result.Day); + Assert.Equal(0, result.Hour); + Assert.Equal(0, result.Minute); + Assert.Equal(0, result.Second); + Assert.Equal(0, result.Millisecond); + Assert.Equal(date.Kind, result.Kind); + } + + [Fact] + public void ToMonth() + { + var date = new DateTime(1987, 6, 5, 4, 3, 2, 1, DateTimeKind.Utc); + var result = date.ToPrecision(DateTimePrecision.Month); + + Assert.Equal(date.Year, result.Year); + Assert.Equal(date.Month, result.Month); + Assert.Equal(1, result.Day); + Assert.Equal(0, result.Hour); + Assert.Equal(0, result.Minute); + Assert.Equal(0, result.Second); + Assert.Equal(0, result.Millisecond); + Assert.Equal(date.Kind, result.Kind); + } + + [Fact] + public void ToYear() + { + var date = new DateTime(1987, 6, 5, 4, 3, 2, 1, DateTimeKind.Utc); + var result = date.ToPrecision(DateTimePrecision.Year); + + Assert.Equal(date.Year, result.Year); + Assert.Equal(1, result.Month); + Assert.Equal(1, result.Day); + Assert.Equal(0, result.Hour); + Assert.Equal(0, result.Minute); + Assert.Equal(0, result.Second); + Assert.Equal(0, result.Millisecond); + Assert.Equal(date.Kind, result.Kind); + } + } + + public class IsEqualToMethod + { + [Fact] + public void CompareMillisecondDifference() + { + var date1 = new DateTime(1987, 6, 5, 4, 3, 2, 1, DateTimeKind.Utc); + var date2 = new DateTime(1987, 6, 5, 4, 3, 2, 2, DateTimeKind.Utc); + var result = date1.IsEqualTo(date2, DateTimePrecision.Millisecond); + Assert.False(result); + } + + [Fact] + public void CompareMillisecondEquality() + { + var date1 = new DateTime(1987, 6, 5, 4, 3, 2, 1, DateTimeKind.Utc); + var date2 = new DateTime(1987, 6, 5, 4, 3, 2, 1, DateTimeKind.Utc); + var result = date1.IsEqualTo(date2, DateTimePrecision.Millisecond); + Assert.True(result); + } + + [Fact] + public void CompareSecondDifference() + { + var date1 = new DateTime(1987, 6, 5, 4, 3, 2, 1, DateTimeKind.Utc); + var date2 = new DateTime(1987, 6, 5, 4, 3, 3, 1, DateTimeKind.Utc); + var result = date1.IsEqualTo(date2, DateTimePrecision.Second); + Assert.False(result); + } + + [Fact] + public void CompareSecondDifference_MsDifferent() + { + var date1 = new DateTime(1987, 6, 5, 4, 3, 2, 1, DateTimeKind.Utc); + var date2 = new DateTime(1987, 6, 5, 4, 3, 3, 2, DateTimeKind.Utc); + var result = date1.IsEqualTo(date2, DateTimePrecision.Second); + Assert.False(result); + } + + [Fact] + public void CompareSecondEquality() + { + var date1 = new DateTime(1987, 6, 5, 4, 3, 2, 1, DateTimeKind.Utc); + var date2 = new DateTime(1987, 6, 5, 4, 3, 2, 1, DateTimeKind.Utc); + var result = date1.IsEqualTo(date2, DateTimePrecision.Second); + Assert.True(result); + } + + [Fact] + public void CompareSecondEquality_MsDifferent() + { + var date1 = new DateTime(1987, 6, 5, 4, 3, 2, 1, DateTimeKind.Utc); + var date2 = new DateTime(1987, 6, 5, 4, 3, 2, 2, DateTimeKind.Utc); + var result = date1.IsEqualTo(date2, DateTimePrecision.Second); + Assert.True(result); + } + + [Fact] + public void CompareMinuteDifference() + { + var date1 = new DateTime(1987, 6, 5, 4, 3, 2, 1, DateTimeKind.Utc); + var date2 = new DateTime(1987, 6, 5, 4, 4, 2, 1, DateTimeKind.Utc); + var result = date1.IsEqualTo(date2, DateTimePrecision.Minute); + Assert.False(result); + } + + [Fact] + public void CompareMinuteDifference_SecondDifferent() + { + var date1 = new DateTime(1987, 6, 5, 4, 3, 2, 1, DateTimeKind.Utc); + var date2 = new DateTime(1987, 6, 5, 4, 4, 3, 1, DateTimeKind.Utc); + var result = date1.IsEqualTo(date2, DateTimePrecision.Minute); + Assert.False(result); + } + + [Fact] + public void CompareMinuteEquality() + { + var date1 = new DateTime(1987, 6, 5, 4, 3, 2, 1, DateTimeKind.Utc); + var date2 = new DateTime(1987, 6, 5, 4, 3, 2, 1, DateTimeKind.Utc); + var result = date1.IsEqualTo(date2, DateTimePrecision.Minute); + Assert.True(result); + } + + [Fact] + public void CompareMinuteEquality_SecondDifferent() + { + var date1 = new DateTime(1987, 6, 5, 4, 3, 2, 1, DateTimeKind.Utc); + var date2 = new DateTime(1987, 6, 5, 4, 3, 3, 2, DateTimeKind.Utc); + var result = date1.IsEqualTo(date2, DateTimePrecision.Minute); + Assert.True(result); + } + } + + public class AsLocalMethod + { + [Fact] + public void SameValues() + { + // prepare + var date = new DateTime(1234, 5, 6, 7, 8, 9, 123, DateTimeKind.Unspecified); + var result = SrkDateTimeExtensions.AsLocal(date); + + // verify + Assert.Equal(date.Year, result.Year); + Assert.Equal(date.Month, result.Month); + Assert.Equal(date.Day, result.Day); + Assert.Equal(date.Hour, result.Hour); + Assert.Equal(date.Minute, result.Minute); + Assert.Equal(date.Second, result.Second); + Assert.Equal(date.Millisecond, result.Millisecond); + Assert.Equal(date.Ticks, result.Ticks); + Assert.Equal(DateTimeKind.Local, result.Kind); + } + } + + public class AsUtcMethod + { + [Fact] + public void SameValues() + { + // prepare + var date = new DateTime(1234, 5, 6, 7, 8, 9, 123, DateTimeKind.Unspecified); + var result = SrkDateTimeExtensions.AsUtc(date); + + // verify + Assert.Equal(date.Year, result.Year); + Assert.Equal(date.Month, result.Month); + Assert.Equal(date.Day, result.Day); + Assert.Equal(date.Hour, result.Hour); + Assert.Equal(date.Minute, result.Minute); + Assert.Equal(date.Second, result.Second); + Assert.Equal(date.Millisecond, result.Millisecond); + Assert.Equal(date.Ticks, result.Ticks); + Assert.Equal(DateTimeKind.Utc, result.Kind); + } + } + + public class AsUnspecifiedMethod + { + [Fact] + public void SameValues() + { + // prepare + var date = new DateTime(1234, 5, 6, 7, 8, 9, 123, DateTimeKind.Local); + var result = SrkDateTimeExtensions.AsUnspecified(date); + + // verify + Assert.Equal(date.Year, result.Year); + Assert.Equal(date.Month, result.Month); + Assert.Equal(date.Day, result.Day); + Assert.Equal(date.Hour, result.Hour); + Assert.Equal(date.Minute, result.Minute); + Assert.Equal(date.Second, result.Second); + Assert.Equal(date.Millisecond, result.Millisecond); + Assert.Equal(date.Ticks, result.Ticks); + Assert.Equal(DateTimeKind.Unspecified, result.Kind); + } + } + + public class ToUnixTimeMethod + { + [Fact] + public void UtcTime() + { + DateTime time = new DateTime(2013, 1, 29, 13, 28, 21, 1, DateTimeKind.Utc); + long result = time.ToUnixTime(); + Assert.Equal(1359466101, result); + } + } + } +} diff --git a/Sources/NET4.SrkToolkit.Common.Tests/SrkIDictionaryExtensionsTests.cs b/Sources/SrkToolkit.Common.FxUnitTests/SrkIDictionaryExtensionsTests.cs similarity index 67% rename from Sources/NET4.SrkToolkit.Common.Tests/SrkIDictionaryExtensionsTests.cs rename to Sources/SrkToolkit.Common.FxUnitTests/SrkIDictionaryExtensionsTests.cs index 041d89a..d01a392 100644 --- a/Sources/NET4.SrkToolkit.Common.Tests/SrkIDictionaryExtensionsTests.cs +++ b/Sources/SrkToolkit.Common.FxUnitTests/SrkIDictionaryExtensionsTests.cs @@ -6,7 +6,6 @@ namespace SrkToolkit.Common.Tests { - using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections; using System.Collections.Generic; @@ -14,13 +13,13 @@ namespace SrkToolkit.Common.Tests using System.Text; using CSrkIDictionaryExtensions = System.Collections.SrkIDictionaryExtensions; using GSrkIDictionaryExtensions = System.Collections.Generic.SrkIDictionaryExtensions; + using Xunit; public class SrkIDictionaryExtensionsTests { - [TestClass] public class GetValueMethod { - [TestMethod] + [Fact] public void NonGeneric_ReturnsStoredValue() { var value = new object(); @@ -28,20 +27,20 @@ public void NonGeneric_ReturnsStoredValue() IDictionary dictionary = new Dictionary(); dictionary.Add(key, value); var result = CSrkIDictionaryExtensions.GetValue(dictionary, key, () => null, true); - Assert.IsTrue(object.ReferenceEquals(result, value)); + Assert.True(object.ReferenceEquals(result, value)); } - [TestMethod] + [Fact] public void NonGeneric_GeneratesValue() { var value = new object(); var key = "key"; IDictionary dictionary = new Dictionary(); var result = CSrkIDictionaryExtensions.GetValue(dictionary, key, () => value, true); - Assert.IsTrue(object.ReferenceEquals(result, value)); + Assert.True(object.ReferenceEquals(result, value)); } - [TestMethod] + [Fact] public void NonGeneric_GeneratedValueIsStored() { var value = new object(); @@ -49,11 +48,11 @@ public void NonGeneric_GeneratedValueIsStored() IDictionary dictionary = new Dictionary(); var result1 = CSrkIDictionaryExtensions.GetValue(dictionary, key, () => value, true); var result2 = CSrkIDictionaryExtensions.GetValue(dictionary, key, () => null, true); - Assert.IsTrue(object.ReferenceEquals(result1, value)); - Assert.IsTrue(object.ReferenceEquals(result2, value)); + Assert.True(object.ReferenceEquals(result1, value)); + Assert.True(object.ReferenceEquals(result2, value)); } - [TestMethod] + [Fact] public void Generic_ReturnsStoredValue() { var value = new object(); @@ -61,19 +60,19 @@ public void Generic_ReturnsStoredValue() IDictionary dictionary = new Dictionary(); dictionary.Add(key, value); var result = GSrkIDictionaryExtensions.GetValue(dictionary, key); - Assert.AreSame(value, result); + Assert.Same(value, result); } - [TestMethod] + [Fact] public void Generic_KeyNotFound_ReturnsNull() { var key = "key"; IDictionary dictionary = new Dictionary(); var result = GSrkIDictionaryExtensions.GetValue(dictionary, key); - Assert.IsNull(result); + Assert.Null(result); } - [TestMethod] + [Fact] public void Generic_NullValue() { object value = null; @@ -81,46 +80,57 @@ public void Generic_NullValue() IDictionary dictionary = new Dictionary(); dictionary.Add(key, value); var result = GSrkIDictionaryExtensions.GetValue(dictionary, key); - Assert.IsNull(result); + Assert.Null(result); } } - [TestClass] public class AddRangeMethod { - [TestMethod, ExpectedException(typeof(ArgumentNullException))] + [Fact] public void ThrowsIfNullArg0() { List source = new List(); Dictionary target = null; - GSrkIDictionaryExtensions.AddRange(target, source, s => s.Id, s => s.Name); + Assert.Throws(() => + { + GSrkIDictionaryExtensions.AddRange(target, source, s => s.Id, s => s.Name); + }); } - [TestMethod, ExpectedException(typeof(ArgumentNullException))] + [Fact] public void ThrowsIfNullArg1() { List source = null; var target = new Dictionary(); - GSrkIDictionaryExtensions.AddRange(target, source, s => s.Id, s => s.Name); + Assert.Throws(() => + { + GSrkIDictionaryExtensions.AddRange(target, source, s => s.Id, s => s.Name); + }); } - [TestMethod, ExpectedException(typeof(ArgumentNullException))] + [Fact] public void ThrowsIfNullArg2() { List source = new List(); var target = new Dictionary(); - GSrkIDictionaryExtensions.AddRange(target, source, null, s => s.Name); + Assert.Throws(() => + { + GSrkIDictionaryExtensions.AddRange(target, source, null, s => s.Name); + }); } - [TestMethod, ExpectedException(typeof(ArgumentNullException))] + [Fact] public void ThrowsIfNullArg3() { List source = new List(); var target = new Dictionary(); - GSrkIDictionaryExtensions.AddRange(target, source, s => s.Id, null); + Assert.Throws(() => + { + GSrkIDictionaryExtensions.AddRange(target, source, s => s.Id, null); + }); } - [TestMethod] + [Fact] public void Works() { var source = new List() @@ -132,16 +142,16 @@ public void Works() var target = new Dictionary(); GSrkIDictionaryExtensions.AddRange(target, source, s => s.Id, s => s); - Assert.AreEqual(3, target.Count); - Assert.IsTrue(target.ContainsKey(1)); - Assert.IsTrue(target.ContainsKey(2)); - Assert.IsTrue(target.ContainsKey(3)); - Assert.AreSame(source[0], target[1]); - Assert.AreSame(source[1], target[2]); - Assert.AreSame(source[2], target[3]); + Assert.Equal(3, target.Count); + Assert.True(target.ContainsKey(1)); + Assert.True(target.ContainsKey(2)); + Assert.True(target.ContainsKey(3)); + Assert.Same(source[0], target[1]); + Assert.Same(source[1], target[2]); + Assert.Same(source[2], target[3]); } - [TestMethod, ExpectedException(typeof(ArgumentException))] + [Fact] public void KeyAlreadyExists() { var source = new List() @@ -152,14 +162,16 @@ public void KeyAlreadyExists() }; var target = new Dictionary(); target.Add(1, new TestModel() { Id = 1, }); - GSrkIDictionaryExtensions.AddRange(target, source, s => s.Id, s => s); + Assert.Throws(() => + { + GSrkIDictionaryExtensions.AddRange(target, source, s => s.Id, s => s); + }); } } - [TestClass] public class MergeMethod { - [TestMethod] + [Fact] public void NoConflict() { var target = new Dictionary(); @@ -172,16 +184,16 @@ public void NoConflict() }; target.Merge(source, m => m.Id, m => m, null); - Assert.AreEqual(3, target.Count); - Assert.IsTrue(target.ContainsKey(1)); - Assert.IsTrue(target.ContainsKey(2)); - Assert.IsTrue(target.ContainsKey(3)); - Assert.AreSame(first, target[1]); - Assert.AreSame(source[0], target[2]); - Assert.AreSame(source[1], target[3]); + Assert.Equal(3, target.Count); + Assert.True(target.ContainsKey(1)); + Assert.True(target.ContainsKey(2)); + Assert.True(target.ContainsKey(3)); + Assert.Same(first, target[1]); + Assert.Same(source[0], target[2]); + Assert.Same(source[1], target[3]); } - [TestMethod] + [Fact] public void EqualConflict() { var target = new Dictionary(); @@ -195,16 +207,16 @@ public void EqualConflict() }; target.Merge(source, m => m.Id, m => m, null); - Assert.AreEqual(3, target.Count); - Assert.IsTrue(target.ContainsKey(1)); - Assert.IsTrue(target.ContainsKey(2)); - Assert.IsTrue(target.ContainsKey(3)); - Assert.AreSame(first, target[1]); - Assert.AreSame(source[1], target[2]); - Assert.AreSame(source[2], target[3]); + Assert.Equal(3, target.Count); + Assert.True(target.ContainsKey(1)); + Assert.True(target.ContainsKey(2)); + Assert.True(target.ContainsKey(3)); + Assert.Same(first, target[1]); + Assert.Same(source[1], target[2]); + Assert.Same(source[2], target[3]); } - [TestMethod, ExpectedException(typeof(InvalidOperationException))] + [Fact] public void RealConflictWithNoResolverThrows() { var target = new Dictionary(); @@ -216,10 +228,13 @@ public void RealConflictWithNoResolverThrows() new TestModel(2), new TestModel(3), }; - target.Merge(source, m => m.Id, m => m, null); + Assert.Throws(() => + { + target.Merge(source, m => m.Id, m => m, null); + }); } - [TestMethod] + [Fact] public void WithConflictResolver() { var target = new Dictionary(); @@ -240,13 +255,13 @@ public void WithConflictResolver() return newValue; }); - Assert.AreEqual(3, target.Count); - Assert.IsTrue(target.ContainsKey(1)); - Assert.IsTrue(target.ContainsKey(2)); - Assert.IsTrue(target.ContainsKey(3)); - Assert.AreSame(source[0], target[1]); - Assert.AreSame(source[1], target[2]); - Assert.AreSame(source[2], target[3]); + Assert.Equal(3, target.Count); + Assert.True(target.ContainsKey(1)); + Assert.True(target.ContainsKey(2)); + Assert.True(target.ContainsKey(3)); + Assert.Same(source[0], target[1]); + Assert.Same(source[1], target[2]); + Assert.Same(source[2], target[3]); } } diff --git a/Sources/NET4.SrkToolkit.Common.Tests/SrkIListExtensionsTests.cs b/Sources/SrkToolkit.Common.FxUnitTests/SrkIListExtensionsTests.cs similarity index 64% rename from Sources/NET4.SrkToolkit.Common.Tests/SrkIListExtensionsTests.cs rename to Sources/SrkToolkit.Common.FxUnitTests/SrkIListExtensionsTests.cs index befaacc..9a1f6db 100644 --- a/Sources/NET4.SrkToolkit.Common.Tests/SrkIListExtensionsTests.cs +++ b/Sources/SrkToolkit.Common.FxUnitTests/SrkIListExtensionsTests.cs @@ -5,47 +5,45 @@ namespace SrkToolkit.Common.Tests using System.Collections.Generic; using System.Linq; using System.Text; - using Microsoft.VisualStudio.TestTools.UnitTesting; + using Xunit; - [TestClass] public class SrkIListExtensionsTests { - [TestClass] public class SingleOrCreateMethod { - [TestMethod] + [Fact] public void NoMatchShouldCreateStruct() { string value = "hello"; var list = new List(); var result = list.SingleOrCreate(x => x == value, () => value); - Assert.AreEqual(value, result); - Assert.AreEqual(1, list.Count); + Assert.Equal(value, result); + Assert.Equal(1, list.Count); } - [TestMethod] + [Fact] public void NoMatchShouldCreateClass() { string value = "hello"; var list = new List(); var result = list.SingleOrCreate(x => x.Key == value, () => new Yo { Key = value, }); - Assert.IsNotNull(result); - Assert.AreEqual(value, result.Key); - Assert.AreEqual(1, list.Count); + Assert.NotNull(result); + Assert.Equal(value, result.Key); + Assert.Equal(1, list.Count); } - [TestMethod] + [Fact] public void OneMatchShouldCreateStruct() { string value = "hello"; var list = new List(); list.Add(value); var result = list.SingleOrCreate(x => x == value, () => value); - Assert.AreEqual(value, result); - Assert.AreEqual(1, list.Count); + Assert.Equal(value, result); + Assert.Equal(1, list.Count); } - [TestMethod] + [Fact] public void OneMatchShouldCreateClass() { string value = "hello"; @@ -53,23 +51,26 @@ public void OneMatchShouldCreateClass() var item = new Yo { Key = value, }; list.Add(item); var result = list.SingleOrCreate(x => x.Key == value, () => new Yo { Key = value, }); - Assert.IsNotNull(result); - Assert.AreSame(item, result); - Assert.AreEqual(value, result.Key); - Assert.AreEqual(1, list.Count); + Assert.NotNull(result); + Assert.Same(item, result); + Assert.Equal(value, result.Key); + Assert.Equal(1, list.Count); } - [TestMethod, ExpectedException(typeof(InvalidOperationException))] + [Fact] public void MultiMatchShouldCreateStruct() { string value = "hello"; var list = new List(); list.Add(value); list.Add(value); - var result = list.SingleOrCreate(x => x == value, () => value); + Assert.Throws(() => + { + var result = list.SingleOrCreate(x => x == value, () => value); + }); } - [TestMethod, ExpectedException(typeof(InvalidOperationException))] + [Fact] public void MultiMatchShouldCreateClass() { string value = "hello"; @@ -77,46 +78,48 @@ public void MultiMatchShouldCreateClass() var item = new Yo { Key = value, }; list.Add(item); list.Add(item); - var result = list.SingleOrCreate(x => x.Key == value, () => new Yo { Key = value, }); + Assert.Throws(() => + { + var result = list.SingleOrCreate(x => x.Key == value, () => new Yo { Key = value, }); + }); } } - [TestClass] public class FirstOrCreateMethod { - [TestMethod] + [Fact] public void NoMatchShouldCreateStruct() { string value = "hello"; var list = new List(); var result = list.FirstOrCreate(x => x == value, () => value); - Assert.AreEqual(value, result); - Assert.AreEqual(1, list.Count); + Assert.Equal(value, result); + Assert.Equal(1, list.Count); } - [TestMethod] + [Fact] public void NoMatchShouldCreateClass() { string value = "hello"; var list = new List(); var result = list.FirstOrCreate(x => x.Key == value, () => new Yo { Key = value, }); - Assert.IsNotNull(result); - Assert.AreEqual(value, result.Key); - Assert.AreEqual(1, list.Count); + Assert.NotNull(result); + Assert.Equal(value, result.Key); + Assert.Equal(1, list.Count); } - [TestMethod] + [Fact] public void OneMatchShouldCreateStruct() { string value = "hello"; var list = new List(); list.Add(value); var result = list.FirstOrCreate(x => x == value, () => value); - Assert.AreEqual(value, result); - Assert.AreEqual(1, list.Count); + Assert.Equal(value, result); + Assert.Equal(1, list.Count); } - [TestMethod] + [Fact] public void OneMatchShouldCreateClass() { string value = "hello"; @@ -124,13 +127,13 @@ public void OneMatchShouldCreateClass() var item = new Yo { Key = value, }; list.Add(item); var result = list.FirstOrCreate(x => x.Key == value, () => new Yo { Key = value, }); - Assert.IsNotNull(result); - Assert.AreSame(item, result); - Assert.AreEqual(value, result.Key); - Assert.AreEqual(1, list.Count); + Assert.NotNull(result); + Assert.Same(item, result); + Assert.Equal(value, result.Key); + Assert.Equal(1, list.Count); } - [TestMethod] + [Fact] public void MultiMatchShouldReturnFirstStruct() { string value = "hello"; @@ -138,11 +141,11 @@ public void MultiMatchShouldReturnFirstStruct() list.Add(value); list.Add(value); var result = list.FirstOrCreate(x => x == value, () => value); - Assert.AreEqual(value, result); - Assert.AreEqual(2, list.Count); + Assert.Equal(value, result); + Assert.Equal(2, list.Count); } - [TestMethod] + [Fact] public void MultiMatchShouldReturnFirstClass() { string value = "hello"; @@ -152,49 +155,48 @@ public void MultiMatchShouldReturnFirstClass() var item2 = new Yo { Key = value, }; list.Add(item2); var result = list.FirstOrCreate(x => x.Key == value, () => new Yo { Key = value, }); - Assert.IsNotNull(result); - Assert.AreSame(item1, result); - Assert.AreEqual(value, result.Key); - Assert.AreEqual(2, list.Count); + Assert.NotNull(result); + Assert.Same(item1, result); + Assert.Equal(value, result.Key); + Assert.Equal(2, list.Count); } } - [TestClass] public class LastOrCreateMethod { - [TestMethod] + [Fact] public void NoMatchShouldCreateStruct() { string value = "hello"; var list = new List(); var result = list.LastOrCreate(x => x == value, () => value); - Assert.AreEqual(value, result); - Assert.AreEqual(1, list.Count); + Assert.Equal(value, result); + Assert.Equal(1, list.Count); } - [TestMethod] + [Fact] public void NoMatchShouldCreateClass() { string value = "hello"; var list = new List(); var result = list.LastOrCreate(x => x.Key == value, () => new Yo { Key = value, }); - Assert.IsNotNull(result); - Assert.AreEqual(value, result.Key); - Assert.AreEqual(1, list.Count); + Assert.NotNull(result); + Assert.Equal(value, result.Key); + Assert.Equal(1, list.Count); } - [TestMethod] + [Fact] public void OneMatchShouldCreateStruct() { string value = "hello"; var list = new List(); list.Add(value); var result = list.LastOrCreate(x => x == value, () => value); - Assert.AreEqual(value, result); - Assert.AreEqual(1, list.Count); + Assert.Equal(value, result); + Assert.Equal(1, list.Count); } - [TestMethod] + [Fact] public void OneMatchShouldCreateClass() { string value = "hello"; @@ -202,13 +204,13 @@ public void OneMatchShouldCreateClass() var item = new Yo { Key = value, }; list.Add(item); var result = list.LastOrCreate(x => x.Key == value, () => new Yo { Key = value, }); - Assert.IsNotNull(result); - Assert.AreSame(item, result); - Assert.AreEqual(value, result.Key); - Assert.AreEqual(1, list.Count); + Assert.NotNull(result); + Assert.Same(item, result); + Assert.Equal(value, result.Key); + Assert.Equal(1, list.Count); } - [TestMethod] + [Fact] public void MultiMatchShouldReturnLastStruct() { string value = "hello"; @@ -216,11 +218,11 @@ public void MultiMatchShouldReturnLastStruct() list.Add(value); list.Add(value); var result = list.LastOrCreate(x => x == value, () => value); - Assert.AreEqual(value, result); - Assert.AreEqual(2, list.Count); + Assert.Equal(value, result); + Assert.Equal(2, list.Count); } - [TestMethod] + [Fact] public void MultiMatchShouldReturnLastClass() { string value = "hello"; @@ -230,10 +232,10 @@ public void MultiMatchShouldReturnLastClass() var item2 = new Yo { Key = value, }; list.Add(item2); var result = list.LastOrCreate(x => x.Key == value, () => new Yo { Key = value, }); - Assert.IsNotNull(result); - Assert.AreSame(item2, result); - Assert.AreEqual(value, result.Key); - Assert.AreEqual(2, list.Count); + Assert.NotNull(result); + Assert.Same(item2, result); + Assert.Equal(value, result.Key); + Assert.Equal(2, list.Count); } } diff --git a/Sources/NET4.SrkToolkit.Common.Tests/SrkNameValueCollectionExtensions.cs b/Sources/SrkToolkit.Common.FxUnitTests/SrkNameValueCollectionExtensions.cs similarity index 64% rename from Sources/NET4.SrkToolkit.Common.Tests/SrkNameValueCollectionExtensions.cs rename to Sources/SrkToolkit.Common.FxUnitTests/SrkNameValueCollectionExtensions.cs index 0f84a59..baae669 100644 --- a/Sources/NET4.SrkToolkit.Common.Tests/SrkNameValueCollectionExtensions.cs +++ b/Sources/SrkToolkit.Common.FxUnitTests/SrkNameValueCollectionExtensions.cs @@ -3,17 +3,16 @@ namespace SrkToolkit.Common.Tests { using System; using System.Collections.Generic; + using System.Collections.Specialized; using System.Linq; using System.Text; - using Microsoft.VisualStudio.TestTools.UnitTesting; - using System.Collections.Specialized; + using Xunit; public class SrkNameValueCollectionExtensionsTests { - [TestClass] public class ToDictionaryMethod { - [TestMethod] + [Fact] public void Works() { // prepare @@ -25,18 +24,17 @@ public void Works() var result = SrkNameValueCollectionExtensions.ToDictionary(source); // verify - Assert.AreEqual(2, result.Count); - Assert.AreEqual("k1", result.Keys.First()); - Assert.AreEqual("k2", result.Keys.Skip(1).First()); - Assert.AreEqual("v1", result["k1"]); - Assert.AreEqual("v2", result["k2"]); + Assert.Equal(2, result.Count); + Assert.Equal("k1", result.Keys.First()); + Assert.Equal("k2", result.Keys.Skip(1).First()); + Assert.Equal("v1", result["k1"]); + Assert.Equal("v2", result["k2"]); } } - [TestClass] public class AsEnumerableMethod { - [TestMethod] + [Fact] public void Works() { // prepare @@ -48,12 +46,12 @@ public void Works() int i = 1; foreach (var item in SrkNameValueCollectionExtensions.AsEnumerable(source)) { - Assert.AreEqual("k" + i, item.Key); - Assert.AreEqual("v" + i, item.Value); + Assert.Equal("k" + i, item.Key); + Assert.Equal("v" + i, item.Value); i++; } - Assert.AreEqual(3, i); + Assert.Equal(3, i); } } } diff --git a/Sources/NET4.SrkToolkit.Common.Tests/SrkStringExtensionsTests.cs b/Sources/SrkToolkit.Common.FxUnitTests/SrkStringExtensionsTests.cs similarity index 63% rename from Sources/NET4.SrkToolkit.Common.Tests/SrkStringExtensionsTests.cs rename to Sources/SrkToolkit.Common.FxUnitTests/SrkStringExtensionsTests.cs index 345c287..9504b4f 100644 --- a/Sources/NET4.SrkToolkit.Common.Tests/SrkStringExtensionsTests.cs +++ b/Sources/SrkToolkit.Common.FxUnitTests/SrkStringExtensionsTests.cs @@ -5,230 +5,234 @@ namespace SrkToolkit.Common.Tests using System.Collections.Generic; using System.Linq; using System.Text; - using Microsoft.VisualStudio.TestTools.UnitTesting; + using Xunit; public class SrkStringExtensionsTests { - [TestClass] public class NullIfEmptyMethod { - [TestMethod] + [Fact] public void Null() { - Assert.IsNull(SrkStringExtensions.NullIfEmpty(null)); + Assert.Null(SrkStringExtensions.NullIfEmpty(null)); } - [TestMethod] + [Fact] public void Empty() { - Assert.IsNull(SrkStringExtensions.NullIfEmpty("")); + Assert.Null(SrkStringExtensions.NullIfEmpty("")); } - [TestMethod] + [Fact] public void Whitespace() { - Assert.IsNotNull(SrkStringExtensions.NullIfEmpty(" \t\r\n")); + Assert.NotNull(SrkStringExtensions.NullIfEmpty(" \t\r\n")); } - [TestMethod] + [Fact] public void Text() { string value = " hello "; - Assert.AreEqual(value, SrkStringExtensions.NullIfEmpty(value)); + Assert.Equal(value, SrkStringExtensions.NullIfEmpty(value)); } - [TestMethod] + [Fact] public void TextTrim() { string value = " hello "; - Assert.AreEqual("hello", SrkStringExtensions.NullIfEmpty(value, true)); + Assert.Equal("hello", SrkStringExtensions.NullIfEmpty(value, true)); } } - [TestClass] public class NullIfEmptyOrWhitespaceMethod { - [TestMethod] + [Fact] public void Null() { - Assert.IsNull(SrkStringExtensions.NullIfEmptyOrWhitespace(null)); + Assert.Null(SrkStringExtensions.NullIfEmptyOrWhitespace(null)); } - [TestMethod] + [Fact] public void Empty() { - Assert.IsNull(SrkStringExtensions.NullIfEmptyOrWhitespace("")); + Assert.Null(SrkStringExtensions.NullIfEmptyOrWhitespace("")); } - [TestMethod] + [Fact] public void Whitespace() { - Assert.IsNull(SrkStringExtensions.NullIfEmptyOrWhitespace(" \t\r\n")); + Assert.Null(SrkStringExtensions.NullIfEmptyOrWhitespace(" \t\r\n")); } - [TestMethod] + [Fact] public void Text() { string value = " hello "; - Assert.AreEqual(value, SrkStringExtensions.NullIfEmptyOrWhitespace(value)); + Assert.Equal(value, SrkStringExtensions.NullIfEmptyOrWhitespace(value)); } - [TestMethod] + [Fact] public void TextTrim() { string value = " hello "; - Assert.AreEqual("hello", SrkStringExtensions.NullIfEmptyOrWhitespace(value, true)); + Assert.Equal("hello", SrkStringExtensions.NullIfEmptyOrWhitespace(value, true)); } } - [TestClass] public class TrimToLengthMethod { - [TestMethod, ExpectedException(typeof(ArgumentOutOfRangeException))] + [Fact] public void SubstringThrowsIfNotLongEnough() { string value = "hello"; - value.Substring(10); + Assert.Throws(() => + { + value.Substring(10); + }); } - [TestMethod] + [Fact] public void TrimToLengthCutsToDesiredLength4() { string value = "hello"; var result = value.TrimToLength(4); - Assert.AreEqual("hell", result); + Assert.Equal("hell", result); } - [TestMethod] + [Fact] public void TrimToLengthCutsToDesiredLength5() { string value = "hello"; var result = value.TrimToLength(5); - Assert.AreEqual("hello", result); + Assert.Equal("hello", result); } - [TestMethod] + [Fact] public void TrimToLengthCutsToDesiredLength6() { string value = "hello"; var result = value.TrimToLength(6); - Assert.AreEqual("hello", result); + Assert.Equal("hello", result); } - [TestMethod] + [Fact] public void TrimToLengthCutsToDesiredLength7() { string value = "hello"; var result = value.TrimToLength(10); - Assert.AreEqual("hello", result); + Assert.Equal("hello", result); } } - [TestClass] public class ContainsAnyStrings { - [TestMethod, ExpectedException(typeof(ArgumentNullException))] + [Fact] public void ThrowsIfArg0IsNull() { - SrkStringExtensions.ContainsAny(null, StringComparison.CurrentCulture, new string[0]); + Assert.Throws(() => + { + SrkStringExtensions.ContainsAny(null, StringComparison.CurrentCulture, new string[0]); + }); } - [TestMethod] + [Fact] public void FalseIsSourceIsEmpty() { string source = string.Empty; bool result = SrkStringExtensions.ContainsAny(source, StringComparison.CurrentCulture, new string[] { string.Empty, }); - Assert.IsFalse(result); + Assert.False(result); } - [TestMethod] + [Fact] public void Finds1() { string source = "hello world"; var values = new string[] { "hello", "guys", }; bool result = SrkStringExtensions.ContainsAny(source, StringComparison.InvariantCulture, values); - Assert.IsTrue(result); + Assert.True(result); } - [TestMethod] + [Fact] public void Finds2() { string source = "hello world"; var values = new string[] { "bye", "world", }; bool result = SrkStringExtensions.ContainsAny(source, StringComparison.InvariantCulture, values); - Assert.IsTrue(result); + Assert.True(result); } - [TestMethod] + [Fact] public void Finds1CaseMatch() { string source = "Hello World"; var values = new string[] { "hello", "guys", }; bool result = SrkStringExtensions.ContainsAny(source, StringComparison.InvariantCulture, values); - Assert.IsFalse(result); + Assert.False(result); } - [TestMethod] + [Fact] public void Finds1CaseIgnore() { string source = "Hello World"; var values = new string[] { "hello", "guys", }; bool result = SrkStringExtensions.ContainsAny(source, StringComparison.InvariantCultureIgnoreCase, values); - Assert.IsTrue(result); + Assert.True(result); } } - [TestClass] public class ContainsAnyChars { - [TestMethod, ExpectedException(typeof(ArgumentNullException))] + [Fact] public void ThrowsIfArg0IsNull() { - SrkStringExtensions.ContainsAny(null, StringComparison.CurrentCulture, new char[0]); + Assert.Throws(() => + { + SrkStringExtensions.ContainsAny(null, StringComparison.CurrentCulture, new char[0]); + }); } - [TestMethod] + [Fact] public void Finds1() { string source = "hello world"; var values = new char[] { 'h', 'x', }; bool result = SrkStringExtensions.ContainsAny(source, StringComparison.InvariantCulture, values); - Assert.IsTrue(result); + Assert.True(result); } - [TestMethod] + [Fact] public void Finds1_Params() { string source = "hello world"; bool result = SrkStringExtensions.ContainsAny(source, StringComparison.InvariantCulture, 'h', 'x'); - Assert.IsTrue(result); + Assert.True(result); } - [TestMethod] + [Fact] public void Finds2() { string source = "hello world"; var values = new char[] { 'x', 'w', }; bool result = SrkStringExtensions.ContainsAny(source, StringComparison.InvariantCulture, values); - Assert.IsTrue(result); + Assert.True(result); } - [TestMethod] + [Fact] public void Finds1CaseMatch() { string source = "Hello World"; var values = new char[] { 'h', 'w', }; bool result = SrkStringExtensions.ContainsAny(source, StringComparison.InvariantCulture, values); - Assert.IsFalse(result); + Assert.False(result); } - [TestMethod] + [Fact] public void Finds1CaseIgnore() { string source = "Hello World"; var values = new char[] { 'h', 'x', }; bool result = SrkStringExtensions.ContainsAny(source, StringComparison.InvariantCultureIgnoreCase, values); - Assert.IsTrue(result); + Assert.True(result); } } } diff --git a/Sources/NET4.SrkToolkit.Common.Tests/SrkStringTransformer.cs b/Sources/SrkToolkit.Common.FxUnitTests/SrkStringTransformer.cs similarity index 77% rename from Sources/NET4.SrkToolkit.Common.Tests/SrkStringTransformer.cs rename to Sources/SrkToolkit.Common.FxUnitTests/SrkStringTransformer.cs index cf36ee4..25196da 100644 --- a/Sources/NET4.SrkToolkit.Common.Tests/SrkStringTransformer.cs +++ b/Sources/SrkToolkit.Common.FxUnitTests/SrkStringTransformer.cs @@ -10,11 +10,10 @@ namespace SrkToolkit.Common.Tests using System.Collections.Generic; using System.Linq; using System.Text; - using Microsoft.VisualStudio.TestTools.UnitTesting; + using Xunit; public class SrkStringTransformerTests { - [TestClass] public class LinksAsHtmlMethod { ////static readonly string linkFormat = "{1}"; @@ -33,7 +32,7 @@ private string Text1formatted get { return text1formatted ?? (text1formatted = text1.LinksAsHtml()); } } - [TestMethod] + [Fact] public void text1_0() { var html = Text1formatted; @@ -42,7 +41,7 @@ public void text1_0() Test(html, url); } - [TestMethod] + [Fact] public void text1_1() { var html = Text1formatted; @@ -51,7 +50,7 @@ public void text1_1() Test(html, url); } - [TestMethod] + [Fact] public void text1_2() { var html = Text1formatted; @@ -60,7 +59,7 @@ public void text1_2() Test(html, url); } - [TestMethod] + [Fact] public void text1_3() { var html = Text1formatted; @@ -69,7 +68,7 @@ public void text1_3() Test(html, url); } - [TestMethod] + [Fact] public void text1_4() { var html = Text1formatted; @@ -78,7 +77,7 @@ public void text1_4() Test(html, url); } - [TestMethod] + [Fact] public void text1_5() { var html = Text1formatted; @@ -87,7 +86,7 @@ public void text1_5() Test(html, url); } - [TestMethod] + [Fact] public void text1_6() { var html = Text1formatted; @@ -96,7 +95,7 @@ public void text1_6() Test(html, url); } - [TestMethod] + [Fact] public void text1_7() { var html = Text1formatted; @@ -105,7 +104,7 @@ public void text1_7() Test(html, url); } - [TestMethod] + [Fact] public void text1_8() { var html = Text1formatted; @@ -114,7 +113,7 @@ public void text1_8() Test(html, url); } - [TestMethod] + [Fact] public void text1_9() { var html = Text1formatted; @@ -123,7 +122,7 @@ public void text1_9() Test(html, url); } - [TestMethod] + [Fact] public void UrlAtBeginning() { string input = "http://gmail.com shows your emails"; @@ -133,7 +132,7 @@ public void UrlAtBeginning() Test(result, expected); } - [TestMethod] + [Fact] public void emailAddress() { string input = "contact me at antoine.sottiau@gmail.com for more info"; @@ -141,14 +140,14 @@ public void emailAddress() string expected = "mailto:antoine.sottiau@gmail.com"; Test(result, expected); - Assert.IsTrue(result.Contains(">antoine.sottiau@gmail.com<")); + Assert.True(result.Contains(">antoine.sottiau@gmail.com<")); } private void Test(string content, string url) { string expected1 = "\"" + url.ProperHtmlAttributeEscape() + "\""; bool valid = content.Contains(expected1); - Assert.IsTrue(valid, "should contain '" + expected1 + "'"); + Assert.True(valid, "should contain '" + expected1 + "'"); } @@ -156,7 +155,7 @@ private void Test(string content, string url) /// Bug where the same link appear multiple time in a string. /// At the end there is only one <a> with a href attribute containing all urls. /// - [TestMethod] + [Fact] public void Bug1() { // prepare @@ -171,13 +170,13 @@ public void Bug1() string result = input.LinksAsHtml(); // verify - Assert.IsTrue(result.Count(c => c == '<') > 2); + Assert.True(result.Count(c => c == '<') > 2); } /// /// URLs containing the symbol & should not be double escaped. /// - [TestMethod] + [Fact] public void Bug2() { string input = "http://site.com/Complex/path.php?key1=val1&key2=value2&openlink=1"; @@ -186,7 +185,7 @@ public void Bug2() this.Test(result, input); } - [TestMethod] + [Fact] public void LongUrlSpanTruncate() { var input = @"hello, http://verylongsub.domain.rules.com/this/is/a/very/long/url/from/hell/and/other/dark/places/and-finaly/a-page.html?with=arguments&and=more&arguments=all&over=the&workd :D"; @@ -196,49 +195,47 @@ public void LongUrlSpanTruncate() SrkToolkit.Testing.Assert.Contains(expected, result); } - [TestMethod] + [Fact] public void LongUrlSpanTruncateNoEsc() { var input = @"hello, http://verylongsub.domain.rules.com/this/is/a/very/long/url/from/hell/and/other/dark/places/and-finaly/a-page.html?with=arguments&and=more&arguments=all&over=the&workd :D"; var expected = ">http://verylongsub.domain.rules.com/this/is/a/very/long/url/from/hell/and/other/dark/places/and-finaly/a-page.html?with=arguments&and=more&arguments=all&over=the&workd<"; var result = input.LinksAsHtml(avoidDoubleEscape: true); - Assert.IsTrue(result.Contains(expected)); + Assert.True(result.Contains(expected)); } } - [TestClass] public class AddHtmlLineBreaksMethod { - [TestMethod] + [Fact] public void WorksWithWindows() { string text = "aaa\r\nbbb\r\nccc"; string expected = "aaa
\r\nbbb
\r\nccc"; string actual = text.AddHtmlLineBreaks(); - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } - [TestMethod] + [Fact] public void WorksWithLinux() { string text = "aaa\nbbb\nccc"; string expected = "aaa
\nbbb
\nccc"; string actual = text.AddHtmlLineBreaks(); - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } - [TestMethod] + [Fact] public void WorksWithStupidProducts() { string text = "aaa\rbbb\rccc"; string expected = "aaa
\rbbb
\rccc"; string actual = text.AddHtmlLineBreaks(); - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } } - [TestClass] public class HtmlParagraphizifyMethod { readonly static string subject = @"p1 @@ -252,25 +249,25 @@ public class HtmlParagraphizifyMethod p3 "; - [TestMethod] + [Fact] public void Single() { string subject = "bla"; string expected = @"

bla

"; string result = subject.HtmlParagraphizify(); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void Single1() { string subject = "bla\n"; string expected = "

bla

"; string result = subject.HtmlParagraphizify(); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void Many() { string expected = @"

p1 @@ -280,10 +277,10 @@ public void Many()

p3 p3

"; string result = subject.HtmlParagraphizify(); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void CombinedWithLineBreaks() { string expected = @"

p1
@@ -293,66 +290,64 @@ public void CombinedWithLineBreaks()

p3
p3

"; string result = subject.HtmlParagraphizify(makeLineBreaks: true); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } } - [TestClass] public class TwitterLinksAsHtmlMethod { - [TestMethod] + [Fact] public void SimpleHash() { var text = "c'est cool de regarder #tf1 à 20h"; var result = text.TwitterLinksAsHtml(); Test(result, "https://twitter.com/search/realtime?q=%23tf1&src=hash"); - Assert.IsTrue(result.Contains("c'est")); - Assert.IsTrue(result.Contains("regarder #tf1 à")); + Assert.True(result.Contains("c'est")); + Assert.True(result.Contains("regarder #tf1 à")); } - [TestMethod] + [Fact] public void SimpleUser() { var text = "suivez tous @kalexandre !"; var result = text.TwitterLinksAsHtml(); Test(result, "https://twitter.com/kalexandre"); - Assert.IsTrue(result.Contains("tous @kalexandre !")); + Assert.True(result.Contains("tous @kalexandre !")); } - [TestMethod] + [Fact] public void HashAtBeginning() { var text = "#tf1 à 20h"; var result = text.TwitterLinksAsHtml(); Test(result, "https://twitter.com/search/realtime?q=%23tf1&src=hash"); - Assert.IsTrue(result.Contains("#tf1 à")); + Assert.True(result.Contains("#tf1 à")); } - [TestMethod] + [Fact] public void UserAtBeginning() { var text = "@kalexandre !"; var result = text.TwitterLinksAsHtml(); Test(result, "https://twitter.com/kalexandre"); - Assert.IsTrue(result.Contains("@kalexandre !")); + Assert.True(result.Contains("@kalexandre !")); } private void Test(string content, string url) { string expected1 = "\"" + url.ProperHtmlEscape() + "\""; bool valid = content.Contains(expected1); - Assert.IsTrue(valid, "should contain '" + expected1 + "'"); + Assert.True(valid, "should contain '" + expected1 + "'"); } } - [TestClass] public class ToUpperFirstLettersMethod { - [TestMethod] + [Fact] public void OneWord() { string input = "hello"; @@ -360,10 +355,10 @@ public void OneWord() string result = input.ToUpperFirstLetters(); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void ManyWords() { string input = "hello world"; @@ -371,10 +366,10 @@ public void ManyWords() string result = input.ToUpperFirstLetters(); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void ManyWords_LeavesOtherCharsAsIs() { string input = "heLLo wORLd"; @@ -382,10 +377,10 @@ public void ManyWords_LeavesOtherCharsAsIs() string result = input.ToUpperFirstLetters(); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void BadPunctuation() { string input = ".hello.world"; @@ -393,14 +388,13 @@ public void BadPunctuation() string result = input.ToUpperFirstLetters(); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } } - [TestClass] public class CapitalizeWordsMethod { - [TestMethod] + [Fact] public void OneWord() { string input = "hello"; @@ -408,10 +402,10 @@ public void OneWord() string result = input.CapitalizeWords(); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void ManyWords() { string input = "hello world"; @@ -419,10 +413,10 @@ public void ManyWords() string result = input.CapitalizeWords(); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void ManyWords_LeavesOtherCharsAsIs() { string input = "heLLo wORLd"; @@ -430,10 +424,10 @@ public void ManyWords_LeavesOtherCharsAsIs() string result = input.CapitalizeWords(); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void BadPunctuation() { string input = ".hello.world"; @@ -441,14 +435,13 @@ public void BadPunctuation() string result = input.CapitalizeWords(); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } } - [TestClass] public class TrimTextRightMethod { - [TestMethod] + [Fact] public void ShorterText() { string input = "hello world"; @@ -456,10 +449,10 @@ public void ShorterText() string result = input.TrimTextRight(12); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void ExactLengthText() { string input = "hello world"; @@ -467,10 +460,10 @@ public void ExactLengthText() string result = input.TrimTextRight(11); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void LongerText() {// 123456789012 456789 string input = "hello greater world"; @@ -478,10 +471,10 @@ public void LongerText() string result = input.TrimTextRight(12); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void LongerTextOnSpace() {// 123456789012345 789 string input = "hello great world"; @@ -489,14 +482,13 @@ public void LongerTextOnSpace() string result = input.TrimTextRight(15); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } } - [TestClass] public class TrimTextLeftMethod { - [TestMethod] + [Fact] public void ShorterText() { string input = "hello world"; @@ -504,10 +496,10 @@ public void ShorterText() string result = input.TrimTextLeft(12); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void ExactLengthText() { string input = "hello world"; @@ -515,10 +507,10 @@ public void ExactLengthText() string result = input.TrimTextLeft(11); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void LongerText() {// 123456789012 456789 string input = "hello greater world"; @@ -527,11 +519,11 @@ public void LongerText() string result = input.TrimTextLeft(length); - Assert.AreEqual(expected, result); - Assert.IsTrue(result.Length <= length); + Assert.Equal(expected, result); + Assert.True(result.Length <= length); } - [TestMethod] + [Fact] public void LongerTextOnSpace() {// 123456789012345 789 string input = "hello great world"; @@ -540,15 +532,14 @@ public void LongerTextOnSpace() string result = input.TrimTextLeft(length); - Assert.AreEqual(expected, result); - Assert.IsTrue(result.Length <= length); + Assert.Equal(expected, result); + Assert.True(result.Length <= length); } } - [TestClass] public class RemoveDiacriticsMethod { - [TestMethod] + [Fact] public void French() { string input = "Là bas se trouvent une çédille et un œuf. L'été fût dur. Par la fenêtre. En grève ex æquo."; @@ -556,10 +547,10 @@ public void French() string result = input.RemoveDiacritics(); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void German() { string input = "German uses the umlauts ä, ö and ü. The eszett (ß) represents the unvoiced s sound."; @@ -567,14 +558,13 @@ public void German() string result = input.RemoveDiacritics(); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } } - [TestClass] public class RemoveSpacesMethod { - [TestMethod] + [Fact] public void SomeSpaces() { string input = " \t\n\r\u00A0\u2002\u2003\u2004\u2005\u205F"; @@ -582,14 +572,13 @@ public void SomeSpaces() string result = input.RemoveSpaces(); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } } - [TestClass] public class RemoveDuplicateSpacesMethod { - [TestMethod] + [Fact] public void AllSpaces() { string input = " \t\n\r\u00A0\u2002\u2003\u2004\u2005\u205F"; @@ -597,10 +586,10 @@ public void AllSpaces() string result = input.RemoveDuplicateSpaces(); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void SpacesAndWordAndSpacesAndWordAndSpaces() { string spaces = " \t\n\r\u00A0\u2002\u2003\u2004 \u2005\u205F"; @@ -609,10 +598,10 @@ public void SpacesAndWordAndSpacesAndWordAndSpaces() string result = input.RemoveDuplicateSpaces(); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void SpacesAndWordAndSpacesAndWord() { string spaces = " \t\n\r\u00A0\u2002\u2003\u2004 \u2005\u205F"; @@ -621,10 +610,10 @@ public void SpacesAndWordAndSpacesAndWord() string result = input.RemoveDuplicateSpaces(); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void WordAndSpacesAndWordAndSpaces() { string spaces = " \t\n\r\u00A0\u2002\u2003\u2004 \u2005\u205F"; @@ -633,14 +622,13 @@ public void WordAndSpacesAndWordAndSpaces() string result = input.RemoveDuplicateSpaces(); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } } - [TestClass] public class MakeUrlFriendlyMethod { - [TestMethod] + [Fact] public void Test() { string input = "German uses the umlauts ä, ö and ü. "; @@ -648,10 +636,10 @@ public void Test() string result = input.MakeUrlFriendly(false); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void PreserveCase() { string input = "German uses the umlauts ä, ö AND ü. "; @@ -659,10 +647,10 @@ public void PreserveCase() string result = input.MakeUrlFriendly(true); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void NoPreserveCase() { string input = "Hello guys, this is SandRock from http://sparklenetworks.com. "; @@ -670,10 +658,10 @@ public void NoPreserveCase() string result = input.MakeUrlFriendly(false); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void PreserveCase1() { string input = "Hello guys, this is SandRock from http://sparklenetworks.com. "; @@ -681,10 +669,10 @@ public void PreserveCase1() string result = input.MakeUrlFriendly(true); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void PreserveCaseAndChars() { string input = "Hello guys, this is SandRock from http://sparklenetworks.com. "; @@ -692,14 +680,13 @@ public void PreserveCaseAndChars() string result = input.MakeUrlFriendly(true, preserveChars: new char[]{ '.', ',', }); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } } - [TestClass] public class GetIncrementedStringMethod { - [TestMethod] + [Fact] public void Nothing() { string input = "test"; @@ -707,10 +694,10 @@ public void Nothing() string result = input.GetIncrementedString(); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void After1Goes2() { string input = "test-1"; @@ -718,10 +705,10 @@ public void After1Goes2() string result = input.GetIncrementedString(); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void After2Goes3() { string input = "test-2"; @@ -729,10 +716,10 @@ public void After2Goes3() string result = input.GetIncrementedString(); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void After9Goes10() { string input = "test-9"; @@ -740,10 +727,10 @@ public void After9Goes10() string result = input.GetIncrementedString(); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void After10Goes11() { string input = "test-10"; @@ -751,10 +738,10 @@ public void After10Goes11() string result = input.GetIncrementedString(); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void AfterNothingGoes7() { string input = "test"; @@ -762,10 +749,10 @@ public void AfterNothingGoes7() string result = input.GetIncrementedString(startIndex: 7); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void After1Goes7() { string input = "test-1"; @@ -773,10 +760,10 @@ public void After1Goes7() string result = input.GetIncrementedString(startIndex: 7); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void After1Goes3() { string input = "test-1"; @@ -784,10 +771,10 @@ public void After1Goes3() string result = input.GetIncrementedString(startIndex: 3); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void After1GoesGreaterThan3() { string input = "test-1"; @@ -808,10 +795,10 @@ public void After1GoesGreaterThan3() } }); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void AfterNothingGoesGreaterThan3() { string input = "test"; @@ -832,14 +819,13 @@ public void AfterNothingGoesGreaterThan3() } }); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } } - [TestClass] public class ProperHtmlEscapeMethod { - [TestMethod] + [Fact] public void Test() { string input = "helo w & or & ld"; @@ -847,10 +833,10 @@ public void Test() string result = input.ProperHtmlEscape(); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void NullArg() { string input = null; @@ -858,10 +844,10 @@ public void NullArg() string result = input.ProperHtmlEscape(); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void AllCharsEscaped() { string input = "&<>\"'/"; @@ -869,14 +855,13 @@ public void AllCharsEscaped() string result = input.ProperHtmlEscape(); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } } - [TestClass] public class ProperHtmlAttributeEscapeMethod { - [TestMethod] + [Fact] public void Test() { string input = "helo w & or & ld"; @@ -884,10 +869,10 @@ public void Test() string result = input.ProperHtmlAttributeEscape(); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void NullArg() { string input = null; @@ -895,72 +880,70 @@ public void NullArg() string result = input.ProperHtmlEscape(); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } } - [TestClass] public class UnescapeUnicodeSequencesMethod { - [TestMethod] + [Fact] public void WorksOn0x3D() { string input = @"\x3D"; string expected = "="; string result = SrkStringTransformer.UnescapeUnicodeSequences(input); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void WorksOnStringWith0x3D() { string input = @"aaaa\x3Daaaa"; string expected = "aaaa=aaaa"; string result = SrkStringTransformer.UnescapeUnicodeSequences(input); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void WorksOnStringWith0x3DDouble() { string input = @"aaaa\x3Daaaa\x3Daaaa"; string expected = "aaaa=aaaa=aaaa"; string result = SrkStringTransformer.UnescapeUnicodeSequences(input); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void WorksOnStringWithHeart() { string input = @"aaaa\xE9aaaa"; string expected = "aaaaéaaaa"; string result = SrkStringTransformer.UnescapeUnicodeSequences(input); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void AtStart() { string input = @"\x3Daaaa"; string expected = "=aaaa"; string result = SrkStringTransformer.UnescapeUnicodeSequences(input); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void AtEnd() { string input = @"aaaa\x3D"; string expected = "aaaa="; string result = SrkStringTransformer.UnescapeUnicodeSequences(input); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } } /* - [TestClass] public class UnescapeUTF8SequencesMethod { - [TestMethod] + [Fact] public void WorksOn0x3D() { string input = @"\x3D"; @@ -968,10 +951,10 @@ public void WorksOn0x3D() string result = SrkStringTransformer.UnescapeUTF8Sequences(input); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void WorksOnStringWith0x3D() { string input = @"aaaa\x3Daaaa"; @@ -979,10 +962,10 @@ public void WorksOnStringWith0x3D() string result = SrkStringTransformer.UnescapeUTF8Sequences(input); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void WorksOnStringWith0x3DDouble() { string input = @"aaaa\x3Daaaa\x3Daaaa"; @@ -990,10 +973,10 @@ public void WorksOnStringWith0x3DDouble() string result = SrkStringTransformer.UnescapeUTF8Sequences(input); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void WorksOnStringWithHeart() { string input = @"aaaa\xE9aaaa"; @@ -1001,10 +984,10 @@ public void WorksOnStringWithHeart() string result = SrkStringTransformer.UnescapeUTF8Sequences(input); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void WorksOnStringWith0021() { string input = @"aaaa\x0021\x21aaaa"; @@ -1012,10 +995,10 @@ public void WorksOnStringWith0021() string result = SrkStringTransformer.UnescapeUTF8Sequences(input); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void WorksOnStringWith0100() { string input = @"aaaa\x0100aaaa"; @@ -1023,10 +1006,10 @@ public void WorksOnStringWith0100() string result = SrkStringTransformer.UnescapeUTF8Sequences(input); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void WorksOnStringWithAD9D() { string input = @"aaaa\xAD9Daaaa"; @@ -1034,15 +1017,14 @@ public void WorksOnStringWithAD9D() string result = SrkStringTransformer.UnescapeUTF8Sequences(input); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } } */ - [TestClass] public class SimplifySpacesMethod { - [TestMethod] + [Fact] public void ModeInline_MultiSpaces_FirstCharBecomesOnlyChar() { string input = " a b \t\r\nc\t\t d\t \t"; @@ -1051,7 +1033,7 @@ public void ModeInline_MultiSpaces_FirstCharBecomesOnlyChar() SrkToolkit.Testing.Assert.AreEqual(expected, result); } - [TestMethod] + [Fact] public void ModeFull_MultiSpaces_FirstCharBecomesOnlyChar() { string input = " a b \t\r\nc\t\t d\t \t"; diff --git a/Sources/NET4.SrkToolkit.Common.Tests/SrkTimeZoneInfoExtensionsTests.cs b/Sources/SrkToolkit.Common.FxUnitTests/SrkTimeZoneInfoExtensionsTests.cs similarity index 50% rename from Sources/NET4.SrkToolkit.Common.Tests/SrkTimeZoneInfoExtensionsTests.cs rename to Sources/SrkToolkit.Common.FxUnitTests/SrkTimeZoneInfoExtensionsTests.cs index 5c6c81a..f86575d 100644 --- a/Sources/NET4.SrkToolkit.Common.Tests/SrkTimeZoneInfoExtensionsTests.cs +++ b/Sources/SrkToolkit.Common.FxUnitTests/SrkTimeZoneInfoExtensionsTests.cs @@ -10,14 +10,13 @@ namespace SrkToolkit.Common.Tests using System.Collections.Generic; using System.Linq; using System.Text; - using Microsoft.VisualStudio.TestTools.UnitTesting; + using Xunit; public class SrkTimeZoneInfoExtensionsTests { - [TestClass] public class ConvertToUtcMethod { - [TestMethod] + [Fact] public void ConvertsTimeFromUnspecified() { // prepare @@ -28,17 +27,17 @@ public void ConvertsTimeFromUnspecified() var result = SrkTimeZoneInfoExtensions.ConvertToUtc(tz, date); // verify - Assert.AreEqual(date.Year, result.Year); - Assert.AreEqual(date.Month, result.Month); - Assert.AreEqual(date.Day, result.Day); - Assert.AreEqual(5, result.Hour); - Assert.AreEqual(date.Minute, result.Minute); - Assert.AreEqual(date.Second, result.Second); - Assert.AreEqual(date.Millisecond, result.Millisecond); - Assert.AreEqual(DateTimeKind.Utc, result.Kind); + Assert.Equal(date.Year, result.Year); + Assert.Equal(date.Month, result.Month); + Assert.Equal(date.Day, result.Day); + Assert.Equal(5, result.Hour); + Assert.Equal(date.Minute, result.Minute); + Assert.Equal(date.Second, result.Second); + Assert.Equal(date.Millisecond, result.Millisecond); + Assert.Equal(DateTimeKind.Utc, result.Kind); } - [TestMethod] + [Fact] public void ConvertsTimeFromUtc() { // prepare @@ -49,18 +48,18 @@ public void ConvertsTimeFromUtc() var result = SrkTimeZoneInfoExtensions.ConvertToUtc(tz, date); // verify - Assert.AreEqual(date.Year, result.Year); - Assert.AreEqual(date.Month, result.Month); - Assert.AreEqual(date.Day, result.Day); - Assert.AreEqual(date.Hour, result.Hour); - Assert.AreEqual(date.Minute, result.Minute); - Assert.AreEqual(date.Second, result.Second); - Assert.AreEqual(date.Millisecond, result.Millisecond); - Assert.AreEqual(date.Ticks, result.Ticks); - Assert.AreEqual(DateTimeKind.Utc, result.Kind); + Assert.Equal(date.Year, result.Year); + Assert.Equal(date.Month, result.Month); + Assert.Equal(date.Day, result.Day); + Assert.Equal(date.Hour, result.Hour); + Assert.Equal(date.Minute, result.Minute); + Assert.Equal(date.Second, result.Second); + Assert.Equal(date.Millisecond, result.Millisecond); + Assert.Equal(date.Ticks, result.Ticks); + Assert.Equal(DateTimeKind.Utc, result.Kind); } - [TestMethod] + [Fact] public void ConvertsTimeFromLocal() { // prepare @@ -71,18 +70,17 @@ public void ConvertsTimeFromLocal() var result = SrkTimeZoneInfoExtensions.ConvertToUtc(tz, date); // verify - Assert.AreEqual(date.Year, result.Year); - Assert.AreEqual(date.Month, result.Month); - Assert.AreEqual(date.Day, result.Day); - Assert.AreEqual(5, result.Hour); - Assert.AreEqual(date.Minute, result.Minute); - Assert.AreEqual(date.Second, result.Second); - Assert.AreEqual(date.Millisecond, result.Millisecond); - Assert.AreEqual(DateTimeKind.Utc, result.Kind); + Assert.Equal(date.Year, result.Year); + Assert.Equal(date.Month, result.Month); + Assert.Equal(date.Day, result.Day); + Assert.Equal(5, result.Hour); + Assert.Equal(date.Minute, result.Minute); + Assert.Equal(date.Second, result.Second); + Assert.Equal(date.Millisecond, result.Millisecond); + Assert.Equal(DateTimeKind.Utc, result.Kind); } } - [TestClass] public class ConvertFromUtcMethod { /* @@ -94,7 +92,7 @@ public class ConvertFromUtcMethod * When converting to the UTC TZ, ensure the DateTime.Kind is UTC. */ - [TestMethod] + [Fact] public void ConvertsTimeFromUnspecified() { // prepare @@ -106,17 +104,17 @@ public void ConvertsTimeFromUnspecified() var result = SrkTimeZoneInfoExtensions.ConvertFromUtc(tzTo, dateFrom); // verify - Assert.AreEqual(dateFrom.Year, result.Year); - Assert.AreEqual(dateFrom.Month, result.Month); - Assert.AreEqual(dateFrom.Day, result.Day); - Assert.AreEqual(dateFrom.Hour + 2, result.Hour); - Assert.AreEqual(dateFrom.Minute, result.Minute); - Assert.AreEqual(dateFrom.Second, result.Second); - Assert.AreEqual(dateFrom.Millisecond, result.Millisecond); - Assert.AreEqual(DateTimeKind.Unspecified, result.Kind); + Assert.Equal(dateFrom.Year, result.Year); + Assert.Equal(dateFrom.Month, result.Month); + Assert.Equal(dateFrom.Day, result.Day); + Assert.Equal(dateFrom.Hour + 2, result.Hour); + Assert.Equal(dateFrom.Minute, result.Minute); + Assert.Equal(dateFrom.Second, result.Second); + Assert.Equal(dateFrom.Millisecond, result.Millisecond); + Assert.Equal(DateTimeKind.Unspecified, result.Kind); } - [TestMethod] + [Fact] public void ConvertsTimeFromUtc() { // prepare @@ -127,17 +125,17 @@ public void ConvertsTimeFromUtc() var result = SrkTimeZoneInfoExtensions.ConvertFromUtc(tzTo, dateFrom); // verify - Assert.AreEqual(dateFrom.Year, result.Year); - Assert.AreEqual(dateFrom.Month, result.Month); - Assert.AreEqual(dateFrom.Day, result.Day); - Assert.AreEqual(dateFrom.Hour + 2, result.Hour); - Assert.AreEqual(dateFrom.Minute, result.Minute); - Assert.AreEqual(dateFrom.Second, result.Second); - Assert.AreEqual(dateFrom.Millisecond, result.Millisecond); - Assert.AreEqual(DateTimeKind.Unspecified, result.Kind); + Assert.Equal(dateFrom.Year, result.Year); + Assert.Equal(dateFrom.Month, result.Month); + Assert.Equal(dateFrom.Day, result.Day); + Assert.Equal(dateFrom.Hour + 2, result.Hour); + Assert.Equal(dateFrom.Minute, result.Minute); + Assert.Equal(dateFrom.Second, result.Second); + Assert.Equal(dateFrom.Millisecond, result.Millisecond); + Assert.Equal(DateTimeKind.Unspecified, result.Kind); } - [TestMethod] + [Fact] public void ConvertsTimeFromLocal() { // prepare @@ -149,18 +147,18 @@ public void ConvertsTimeFromLocal() var result = SrkTimeZoneInfoExtensions.ConvertFromUtc(tzTo, dateFrom); // verify - Assert.AreEqual(dateFrom.Year, result.Year); - Assert.AreEqual(dateFrom.Month, result.Month); - Assert.AreEqual(dateFrom.Day, result.Day); + Assert.Equal(dateFrom.Year, result.Year); + Assert.Equal(dateFrom.Month, result.Month); + Assert.Equal(dateFrom.Day, result.Day); var expectedHour = dateFrom.Hour - tzFrom.GetUtcOffset(dateFrom).TotalHours + tzTo.GetUtcOffset(dateFrom).TotalHours; - Assert.AreEqual(expectedHour, result.Hour); - Assert.AreEqual(dateFrom.Minute, result.Minute); - Assert.AreEqual(dateFrom.Second, result.Second); - Assert.AreEqual(dateFrom.Millisecond, result.Millisecond); - Assert.AreEqual(DateTimeKind.Unspecified, result.Kind); + Assert.Equal(expectedHour, result.Hour); + Assert.Equal(dateFrom.Minute, result.Minute); + Assert.Equal(dateFrom.Second, result.Second); + Assert.Equal(dateFrom.Millisecond, result.Millisecond); + Assert.Equal(DateTimeKind.Unspecified, result.Kind); } - [TestMethod] + [Fact] public void ConvertsTimeFromUnspecified_ToUtc() { // prepare @@ -171,17 +169,17 @@ public void ConvertsTimeFromUnspecified_ToUtc() var result = SrkTimeZoneInfoExtensions.ConvertFromUtc(tzTo, dateFrom); // verify - Assert.AreEqual(dateFrom.Year, result.Year); - Assert.AreEqual(dateFrom.Month, result.Month); - Assert.AreEqual(dateFrom.Day, result.Day); - Assert.AreEqual(dateFrom.Hour, result.Hour); - Assert.AreEqual(dateFrom.Minute, result.Minute); - Assert.AreEqual(dateFrom.Second, result.Second); - Assert.AreEqual(dateFrom.Millisecond, result.Millisecond); - Assert.AreEqual(DateTimeKind.Utc, result.Kind); + Assert.Equal(dateFrom.Year, result.Year); + Assert.Equal(dateFrom.Month, result.Month); + Assert.Equal(dateFrom.Day, result.Day); + Assert.Equal(dateFrom.Hour, result.Hour); + Assert.Equal(dateFrom.Minute, result.Minute); + Assert.Equal(dateFrom.Second, result.Second); + Assert.Equal(dateFrom.Millisecond, result.Millisecond); + Assert.Equal(DateTimeKind.Utc, result.Kind); } - [TestMethod] + [Fact] public void ConvertsTimeFromUtc_ToUtc() { // prepare @@ -192,17 +190,17 @@ public void ConvertsTimeFromUtc_ToUtc() var result = SrkTimeZoneInfoExtensions.ConvertFromUtc(tzTo, dateFrom); // verify - Assert.AreEqual(dateFrom.Year, result.Year); - Assert.AreEqual(dateFrom.Month, result.Month); - Assert.AreEqual(dateFrom.Day, result.Day); - Assert.AreEqual(dateFrom.Hour, result.Hour); - Assert.AreEqual(dateFrom.Minute, result.Minute); - Assert.AreEqual(dateFrom.Second, result.Second); - Assert.AreEqual(dateFrom.Millisecond, result.Millisecond); - Assert.AreEqual(DateTimeKind.Utc, result.Kind); + Assert.Equal(dateFrom.Year, result.Year); + Assert.Equal(dateFrom.Month, result.Month); + Assert.Equal(dateFrom.Day, result.Day); + Assert.Equal(dateFrom.Hour, result.Hour); + Assert.Equal(dateFrom.Minute, result.Minute); + Assert.Equal(dateFrom.Second, result.Second); + Assert.Equal(dateFrom.Millisecond, result.Millisecond); + Assert.Equal(DateTimeKind.Utc, result.Kind); } - [TestMethod] + [Fact] public void ConvertsTimeFromLocal_ToUtc() { // prepare @@ -214,15 +212,15 @@ public void ConvertsTimeFromLocal_ToUtc() var result = SrkTimeZoneInfoExtensions.ConvertFromUtc(tzTo, dateFrom); // verify - Assert.AreEqual(dateFrom.Year, result.Year); - Assert.AreEqual(dateFrom.Month, result.Month); - Assert.AreEqual(dateFrom.Day, result.Day); + Assert.Equal(dateFrom.Year, result.Year); + Assert.Equal(dateFrom.Month, result.Month); + Assert.Equal(dateFrom.Day, result.Day); var expectedHour = dateFrom.Hour - tzFrom.GetUtcOffset(dateFrom).TotalHours + tzTo.GetUtcOffset(dateFrom).TotalHours; - Assert.AreEqual(expectedHour, result.Hour); - Assert.AreEqual(dateFrom.Minute, result.Minute); - Assert.AreEqual(dateFrom.Second, result.Second); - Assert.AreEqual(dateFrom.Millisecond, result.Millisecond); - Assert.AreEqual(DateTimeKind.Utc, result.Kind); + Assert.Equal(expectedHour, result.Hour); + Assert.Equal(dateFrom.Minute, result.Minute); + Assert.Equal(dateFrom.Second, result.Second); + Assert.Equal(dateFrom.Millisecond, result.Millisecond); + Assert.Equal(DateTimeKind.Utc, result.Kind); } } } diff --git a/Sources/SrkToolkit.Common.FxUnitTests/SrkToolkit.Common.FxUnitTests.csproj b/Sources/SrkToolkit.Common.FxUnitTests/SrkToolkit.Common.FxUnitTests.csproj new file mode 100644 index 0000000..077c90c --- /dev/null +++ b/Sources/SrkToolkit.Common.FxUnitTests/SrkToolkit.Common.FxUnitTests.csproj @@ -0,0 +1,99 @@ + + + + + Debug + AnyCPU + {00457CE3-FE08-4AF2-972E-4C2EDD36F38D} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Library + Properties + SrkToolkit.Common.FxUnitTests + SrkToolkit.Common.FxUnitTests + v4.7.2 + 512 + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE;NETFRAMEWORK + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE;NETFRAMEWORK + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {9442b344-fc0d-4a0b-be0e-d317c72f2a8e} + SrkToolkit.Common + + + + + + + + + + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + diff --git a/Sources/NET4.SrkToolkit.Common.Tests/StringReplacerTests.cs b/Sources/SrkToolkit.Common.FxUnitTests/StringReplacerTests.cs similarity index 86% rename from Sources/NET4.SrkToolkit.Common.Tests/StringReplacerTests.cs rename to Sources/SrkToolkit.Common.FxUnitTests/StringReplacerTests.cs index acc40ec..361776d 100644 --- a/Sources/NET4.SrkToolkit.Common.Tests/StringReplacerTests.cs +++ b/Sources/SrkToolkit.Common.FxUnitTests/StringReplacerTests.cs @@ -1,17 +1,16 @@  namespace SrkToolkit.Common.Tests { - using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; + using Xunit; - [TestClass] public class StringReplacerTests { - [TestMethod] + [Fact] public void Simple() { var target = new StringReplacer(); @@ -19,10 +18,10 @@ public void Simple() var text = "Hello {Hello}"; var expected = "Hello World"; var result = target.Replace(text); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void SimpleAndDefault() { var target = new StringReplacer(); @@ -30,10 +29,10 @@ public void SimpleAndDefault() var text = "Hello {Hello} {Other}"; var expected = "Hello World "; var result = target.Replace(text); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void SimpleAndCustomDefault() { var target = new StringReplacer(); @@ -42,10 +41,10 @@ public void SimpleAndCustomDefault() var text = "Hello {Hello} {Other}"; var expected = "Hello World ???"; var result = target.Replace(text); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void SimpleWithCulture() { var model = new UserModel @@ -59,10 +58,10 @@ public void SimpleWithCulture() var culture = new CultureInfo("en-US"); var tz = TimeZoneInfo.Local; var result = target.Replace(text, culture, tz); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void SimpleWithCulture1() { var model = new UserModel @@ -76,10 +75,10 @@ public void SimpleWithCulture1() var culture = new CultureInfo("fr-FR"); var tz = TimeZoneInfo.Local; var result = target.Replace(text, culture, tz); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void Model() { var model = new UserModel @@ -91,10 +90,10 @@ public void Model() var text = "Hello {User.Name}"; var expected = "Hello Johny"; var result = target.Replace(text, model); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void ModelAndDefault() { var model = new UserModel @@ -106,10 +105,10 @@ public void ModelAndDefault() var text = "Hello {User.Name} {Other}"; var expected = "Hello Johny "; var result = target.Replace(text, model); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void ModelAndCustomDefault() { var model = new UserModel @@ -122,10 +121,10 @@ public void ModelAndCustomDefault() var text = "Hello {User.Name} {Other}"; var expected = "Hello Johny ??Other??"; var result = target.Replace(text, model); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void ModelWithCulture() { var model = new UserModel @@ -139,10 +138,10 @@ public void ModelWithCulture() var text = "Hello {User.Date}"; var expected = "Hello " + model.Date.ToString("d", culture); var result = target.Replace(text, model, culture, tz); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void ModelWithReplacerCulture_EnglishUSA() { var model = new UserModel @@ -156,10 +155,10 @@ public void ModelWithReplacerCulture_EnglishUSA() var text = "Hello {User.Date}"; var expected = "Hello " + model.Date.ToString("d", culture); var result = target.Replace(text, model); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void ModelWithReplacerCulture_FrenchFrance() { var model = new UserModel @@ -173,10 +172,10 @@ public void ModelWithReplacerCulture_FrenchFrance() var text = "Hello {User.Date}"; var expected = "Hello " + model.Date.ToString("d", culture); var result = target.Replace(text, model); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void ModelWithCulture1() { var model = new UserModel @@ -190,10 +189,10 @@ public void ModelWithCulture1() var culture = new CultureInfo("fr-FR"); var tz = TimeZoneInfo.Local; var result = target.Replace(text, model, culture, tz); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void ModelWithTimezone1() { var model = new UserModel @@ -207,10 +206,10 @@ public void ModelWithTimezone1() var culture = new CultureInfo("en-US"); var tz = TimeZoneInfo.Utc; var result = target.Replace(text, model, culture, tz); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void ModelWithTimezone2() { var model = new UserModel @@ -224,7 +223,7 @@ public void ModelWithTimezone2() var culture = new CultureInfo("en-US"); var tz = TimeZoneInfo.FindSystemTimeZoneById("Romance Standard Time"); var result = target.Replace(text, model, culture, tz); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } public class UserModel diff --git a/Sources/NET4.SrkToolkit.Common.Tests/ValidateTEsts.cs b/Sources/SrkToolkit.Common.FxUnitTests/ValidateTEsts.cs similarity index 72% rename from Sources/NET4.SrkToolkit.Common.Tests/ValidateTEsts.cs rename to Sources/SrkToolkit.Common.FxUnitTests/ValidateTEsts.cs index 6606fbc..c1706e8 100644 --- a/Sources/NET4.SrkToolkit.Common.Tests/ValidateTEsts.cs +++ b/Sources/SrkToolkit.Common.FxUnitTests/ValidateTEsts.cs @@ -6,184 +6,181 @@ namespace SrkToolkit.Common.Tests { + using SrkToolkit.Common.Validation; using System; using System.Collections.Generic; using System.Linq; using System.Text; - using Microsoft.VisualStudio.TestTools.UnitTesting; - using SrkToolkit.Common.Validation; + using Xunit; /// /// TODO: Update summary. /// public class ValidateTEsts { - [TestClass] public class EmailAddressMethod { - [TestMethod] + [Fact] public void SimpleAddress() { string input = "antoine@gmail.com"; var result = Validate.EmailAddress(input); - Assert.AreEqual(input, result); + Assert.Equal(input, result); } - [TestMethod] + [Fact] public void Loweryfies() { string input = "Antoine@Gmail.com"; string expected = "antoine@gmail.com"; var result = Validate.EmailAddress(input); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void FirstAndLastNameAddress() { string input = "antoine.sottiau@gmail.com"; var result = Validate.EmailAddress(input); - Assert.AreEqual(input, result); + Assert.Equal(input, result); } - [TestMethod] + [Fact] public void FirstAndLastNameAndPlusAddress() { string input = "antoine.sottiau+something-special@gmail.com"; var result = Validate.EmailAddress(input); - Assert.AreEqual(input, result); + Assert.Equal(input, result); } - [TestMethod] + [Fact] public void NoAtSign() { string input = "Antoine.Gmail.com"; string expected = null; var result = Validate.EmailAddress(input); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void EmailCharacterInternational() { string input = "testspecïalchar@toto.com"; var result = Validate.EmailAddress(input); - Assert.AreEqual(input, result); + Assert.Equal(input, result); } - [TestMethod] + [Fact] public void EmailCharacterSingleQuote() { string input = "testspec'alchar@toto.com"; var result = Validate.EmailAddress(input); - Assert.AreEqual(input, result); + Assert.Equal(input, result); } } - [TestClass] public class ManyEmailAddressesMethod { - [TestMethod] + [Fact] public void ReturnsEmptyEnumerationOnNullInput() { string input = null; var result = Validate.ManyEmailAddresses(input).ToArray(); - Assert.AreEqual(0, result.Length); + Assert.Equal(0, result.Length); } - [TestMethod] + [Fact] public void Works() { string input = "blah antoine.sottiau+something-special@gmail.com Antoine@Gmail.com xxxxxx"; var result = Validate.ManyEmailAddresses(input).ToArray(); - Assert.AreEqual(2, result.Length); - Assert.AreEqual("antoine.sottiau+something-special@gmail.com", result[0]); - Assert.AreEqual("antoine@gmail.com", result[1]); + Assert.Equal(2, result.Length); + Assert.Equal("antoine.sottiau+something-special@gmail.com", result[0]); + Assert.Equal("antoine@gmail.com", result[1]); } } - [TestClass] public class PhoneNumberMethod { - [TestMethod] + [Fact] public void ValidPerfectNumber() { string input = "+33123456789"; string expected = input; string result = Validate.PhoneNumber(input); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void ValidPerfectTrimmedNumber() { string input = "\t+33123456789 \r\n "; string expected = "+33123456789"; string result = Validate.PhoneNumber(input); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void ValidPerfectSpacedNumber() { string input = "+33 123 456 789"; string expected = "+33123456789"; string result = Validate.PhoneNumber(input); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void ValidPerfectSeparatedNumber() { string input = "+33 123/456-789.012"; string expected = "+33123456789012"; string result = Validate.PhoneNumber(input); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void ZeroZeroNumber() { string input = "0033123456789"; string expected = "+33123456789"; string result = Validate.PhoneNumber(input); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void NationalReturnsNull() { string input = "0123456789"; string expected = null; string result = Validate.PhoneNumber(input); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void NationalAccepted() { string input = "0123456789"; string expected = "0123456789"; string result = Validate.PhoneNumber(input, true); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void NationalNonZeroAccepted() { string input = "123456789"; string expected = "123456789"; string result = Validate.PhoneNumber(input, true); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void IntlWithOptionalZero() { string input = "+33 (0) 123456789"; string expected = "+33123456789"; string result = Validate.PhoneNumber(input); - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } } } diff --git a/Sources/NET4.SrkToolkit.Common/Collections/DictionaryWrapper.cs b/Sources/SrkToolkit.Common/Collections/DictionaryWrapper.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Common/Collections/DictionaryWrapper.cs rename to Sources/SrkToolkit.Common/Collections/DictionaryWrapper.cs diff --git a/Sources/NET4.SrkToolkit.Common/CompositeDisposable.cs b/Sources/SrkToolkit.Common/CompositeDisposable.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Common/CompositeDisposable.cs rename to Sources/SrkToolkit.Common/CompositeDisposable.cs diff --git a/Sources/NET4.SrkToolkit.Common/DataAnnotations/CultureInfoAttribute.cs b/Sources/SrkToolkit.Common/DataAnnotations/CultureInfoAttribute.cs similarity index 95% rename from Sources/NET4.SrkToolkit.Common/DataAnnotations/CultureInfoAttribute.cs rename to Sources/SrkToolkit.Common/DataAnnotations/CultureInfoAttribute.cs index 0b70c3a..3945c11 100644 --- a/Sources/NET4.SrkToolkit.Common/DataAnnotations/CultureInfoAttribute.cs +++ b/Sources/SrkToolkit.Common/DataAnnotations/CultureInfoAttribute.cs @@ -14,6 +14,8 @@ // limitations under the License. // +#if NETFRAMEWORK + namespace SrkToolkit.DataAnnotations { using System; @@ -84,3 +86,4 @@ public override bool IsValid(object value) } } } +#endif diff --git a/Sources/NET4.SrkToolkit.Common/DataAnnotations/DateRangeAttribute.cs b/Sources/SrkToolkit.Common/DataAnnotations/DateRangeAttribute.cs similarity index 96% rename from Sources/NET4.SrkToolkit.Common/DataAnnotations/DateRangeAttribute.cs rename to Sources/SrkToolkit.Common/DataAnnotations/DateRangeAttribute.cs index 2eec443..0587cf2 100644 --- a/Sources/NET4.SrkToolkit.Common/DataAnnotations/DateRangeAttribute.cs +++ b/Sources/SrkToolkit.Common/DataAnnotations/DateRangeAttribute.cs @@ -14,6 +14,8 @@ // limitations under the License. // +#if NETFRAMEWORK + namespace SrkToolkit.DataAnnotations { using System; @@ -161,3 +163,4 @@ public override string FormatErrorMessage(string name) } } } +#endif diff --git a/Sources/SrkToolkit.Common/DataAnnotations/Dummy.cs b/Sources/SrkToolkit.Common/DataAnnotations/Dummy.cs new file mode 100644 index 0000000..b1332b6 --- /dev/null +++ b/Sources/SrkToolkit.Common/DataAnnotations/Dummy.cs @@ -0,0 +1,12 @@ + +namespace SrkToolkit.DataAnnotations +{ + using System; + + /// + /// This class only helps keeps the namespace available. + /// + public static class Dummy + { + } +} diff --git a/Sources/NET4.SrkToolkit.Common/DataAnnotations/EmailAddressAttribute.cs b/Sources/SrkToolkit.Common/DataAnnotations/EmailAddressAttribute.cs similarity index 93% rename from Sources/NET4.SrkToolkit.Common/DataAnnotations/EmailAddressAttribute.cs rename to Sources/SrkToolkit.Common/DataAnnotations/EmailAddressAttribute.cs index 8f40ca6..42b410d 100644 --- a/Sources/NET4.SrkToolkit.Common/DataAnnotations/EmailAddressAttribute.cs +++ b/Sources/SrkToolkit.Common/DataAnnotations/EmailAddressAttribute.cs @@ -16,14 +16,20 @@ namespace SrkToolkit.DataAnnotations { + using SrkToolkit.Resources; using System; - using System.ComponentModel.DataAnnotations; using System.Globalization; - using System.Text.RegularExpressions; - using SrkToolkit.Resources; using System.Reflection; + using System.Text.RegularExpressions; - // TODO: support for netstandard +#if NET40 || NETFRAMEWORK + using System.ComponentModel.DataAnnotations; +#endif + + // This namespace is hard to support with multi-framework + // NET40: reference to System.ComponentModel.DataAnnotations + // NET46: nuget? + // NSTD: no support ? /// /// Validates an email address field (one or multiple addresses). @@ -31,9 +37,11 @@ namespace SrkToolkit.DataAnnotations #if NET40 [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)] public class EmailAddressAttribute : ValidationAttribute -#else +#elif NETFRAMEWORK [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)] public class EmailAddressExAttribute : ValidationAttribute +#else + public class EmailAddressExAttribute #endif { /// @@ -46,17 +54,17 @@ public class EmailAddressExAttribute : ValidationAttribute /// /// Initializes a new instance of the class. /// -#if NET40 +#if NET40 || NETFRAMEWORK public EmailAddressAttribute() -#else - public EmailAddressExAttribute() -#endif { -#if !NSTD this.ErrorMessageResourceName = "EmailAddressAttribute_ErrorMessage"; this.ErrorMessageResourceType = typeof(Strings); -#endif } +#else + public EmailAddressExAttribute() + { + } +#endif /// /// Gets or sets a value indicating whether to allow multiple addresses in a single field. Default is false. Use to parse addresses. @@ -81,7 +89,7 @@ public EmailAddressExAttribute() /// protected Regex Regex { get; set; } -#if !NSTD +#if NET40 || NETFRAMEWORK /// /// Validates the specified value with respect to the current validation attribute. /// diff --git a/Sources/NET4.SrkToolkit.Common/DataAnnotations/PhoneNumberAttribute.cs b/Sources/SrkToolkit.Common/DataAnnotations/PhoneNumberAttribute.cs similarity index 96% rename from Sources/NET4.SrkToolkit.Common/DataAnnotations/PhoneNumberAttribute.cs rename to Sources/SrkToolkit.Common/DataAnnotations/PhoneNumberAttribute.cs index af7b0af..69e478b 100644 --- a/Sources/NET4.SrkToolkit.Common/DataAnnotations/PhoneNumberAttribute.cs +++ b/Sources/SrkToolkit.Common/DataAnnotations/PhoneNumberAttribute.cs @@ -14,6 +14,8 @@ // limitations under the License. // +#if NETFRAMEWORK + namespace SrkToolkit.DataAnnotations { using SrkToolkit.Resources; @@ -87,3 +89,4 @@ public static bool ConvertNationalToInternational(string value, CultureInfo cult } } } +#endif diff --git a/Sources/NET4.SrkToolkit.Common/DataAnnotations/TimezoneAttribute.cs b/Sources/SrkToolkit.Common/DataAnnotations/TimezoneAttribute.cs similarity index 95% rename from Sources/NET4.SrkToolkit.Common/DataAnnotations/TimezoneAttribute.cs rename to Sources/SrkToolkit.Common/DataAnnotations/TimezoneAttribute.cs index 525deda..cc0855e 100644 --- a/Sources/NET4.SrkToolkit.Common/DataAnnotations/TimezoneAttribute.cs +++ b/Sources/SrkToolkit.Common/DataAnnotations/TimezoneAttribute.cs @@ -14,6 +14,8 @@ // limitations under the License. // +#if NETFRAMEWORK + namespace SrkToolkit.DataAnnotations { using System; @@ -70,3 +72,4 @@ public override bool IsValid(object value) } } } +#endif diff --git a/Sources/NET4.SrkToolkit.Common/DataAnnotations/TwitterUsernameAttribute.cs b/Sources/SrkToolkit.Common/DataAnnotations/TwitterUsernameAttribute.cs similarity index 96% rename from Sources/NET4.SrkToolkit.Common/DataAnnotations/TwitterUsernameAttribute.cs rename to Sources/SrkToolkit.Common/DataAnnotations/TwitterUsernameAttribute.cs index 2da6742..7685540 100644 --- a/Sources/NET4.SrkToolkit.Common/DataAnnotations/TwitterUsernameAttribute.cs +++ b/Sources/SrkToolkit.Common/DataAnnotations/TwitterUsernameAttribute.cs @@ -14,6 +14,8 @@ // limitations under the License. // +#if NETFRAMEWORK + namespace SrkToolkit.DataAnnotations { using SrkToolkit.Resources; @@ -74,3 +76,4 @@ public static bool GetUsername(string value, out string username) } } } +#endif diff --git a/Sources/NET4.SrkToolkit.Common/DisposableOnce.cs b/Sources/SrkToolkit.Common/DisposableOnce.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Common/DisposableOnce.cs rename to Sources/SrkToolkit.Common/DisposableOnce.cs diff --git a/Sources/NET4.SrkToolkit.Common/EnumTools.cs b/Sources/SrkToolkit.Common/EnumTools.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Common/EnumTools.cs rename to Sources/SrkToolkit.Common/EnumTools.cs diff --git a/Sources/NET4.SrkToolkit.Common/Globalization/CultureInfoHelper.cs b/Sources/SrkToolkit.Common/Globalization/CultureInfoHelper.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Common/Globalization/CultureInfoHelper.cs rename to Sources/SrkToolkit.Common/Globalization/CultureInfoHelper.cs diff --git a/Sources/SrkToolkit.Common/IO/Dummy.cs b/Sources/SrkToolkit.Common/IO/Dummy.cs new file mode 100644 index 0000000..83bd186 --- /dev/null +++ b/Sources/SrkToolkit.Common/IO/Dummy.cs @@ -0,0 +1,12 @@ + +namespace SrkToolkit.IO +{ + using System; + + /// + /// This class only helps keeps the namespace available. + /// + public static class Dummy + { + } +} diff --git a/Sources/NET4.SrkToolkit.Common/IO/RecursiveDelete.cs b/Sources/SrkToolkit.Common/IO/RecursiveDelete.cs similarity index 96% rename from Sources/NET4.SrkToolkit.Common/IO/RecursiveDelete.cs rename to Sources/SrkToolkit.Common/IO/RecursiveDelete.cs index 20f8063..9644840 100644 --- a/Sources/NET4.SrkToolkit.Common/IO/RecursiveDelete.cs +++ b/Sources/SrkToolkit.Common/IO/RecursiveDelete.cs @@ -14,6 +14,8 @@ // limitations under the License. // +#if NETFRAMEWORK + namespace SrkToolkit.IO { using System; @@ -131,3 +133,4 @@ private void Recurse(string path, bool deletePath) } } } +#endif diff --git a/Sources/NET4.SrkToolkit.Common/Internals/Nothing.cs b/Sources/SrkToolkit.Common/Internals/Nothing.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Common/Internals/Nothing.cs rename to Sources/SrkToolkit.Common/Internals/Nothing.cs diff --git a/Sources/NET4.SrkToolkit.Common/Internals/RetryLogicState.cs b/Sources/SrkToolkit.Common/Internals/RetryLogicState.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Common/Internals/RetryLogicState.cs rename to Sources/SrkToolkit.Common/Internals/RetryLogicState.cs diff --git a/Sources/NET4.SrkToolkit.Common/Resources/Strings.Designer.cs b/Sources/SrkToolkit.Common/Resources/Strings.Designer.cs similarity index 96% rename from Sources/NET4.SrkToolkit.Common/Resources/Strings.Designer.cs rename to Sources/SrkToolkit.Common/Resources/Strings.Designer.cs index eb0d1c5..4b8acd6 100644 --- a/Sources/NET4.SrkToolkit.Common/Resources/Strings.Designer.cs +++ b/Sources/SrkToolkit.Common/Resources/Strings.Designer.cs @@ -1,7 +1,6 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.18444 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -39,7 +38,7 @@ internal Strings() { public static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SrkToolkit.Resources.Strings", typeof(Strings).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SrkToolkit.Common.Resources.Strings", typeof(Strings).Assembly); resourceMan = temp; } return resourceMan; diff --git a/Sources/NET4.SrkToolkit.Common/Resources/Strings.fr.resx b/Sources/SrkToolkit.Common/Resources/Strings.fr.resx similarity index 100% rename from Sources/NET4.SrkToolkit.Common/Resources/Strings.fr.resx rename to Sources/SrkToolkit.Common/Resources/Strings.fr.resx diff --git a/Sources/NET4.SrkToolkit.Common/Resources/Strings.resx b/Sources/SrkToolkit.Common/Resources/Strings.resx similarity index 100% rename from Sources/NET4.SrkToolkit.Common/Resources/Strings.resx rename to Sources/SrkToolkit.Common/Resources/Strings.resx diff --git a/Sources/NET4.SrkToolkit.Common/RetryIntervalStrategy.cs b/Sources/SrkToolkit.Common/RetryIntervalStrategy.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Common/RetryIntervalStrategy.cs rename to Sources/SrkToolkit.Common/RetryIntervalStrategy.cs diff --git a/Sources/NET4.SrkToolkit.Common/RetryLogic.cs b/Sources/SrkToolkit.Common/RetryLogic.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Common/RetryLogic.cs rename to Sources/SrkToolkit.Common/RetryLogic.cs diff --git a/Sources/SrkToolkit.Common/SrkToolkit.Common.csproj b/Sources/SrkToolkit.Common/SrkToolkit.Common.csproj new file mode 100644 index 0000000..580d88e --- /dev/null +++ b/Sources/SrkToolkit.Common/SrkToolkit.Common.csproj @@ -0,0 +1,37 @@ + + + + disable + disable + net40;net7.0;netstandard2.0 + 9 + true + 2.0.0-preview + SandRock, pyDez + SrkToolkit.Common contains various extension methods, validators and utility classes. + https://github.com/sandrock/SrkToolkit/ + https://github.com/sandrock/SrkToolkit/blob/master/LICENSE + SrkToolkit extension method extensions methods dataannotations validation + 2.0.0.0 + 2.0.0.0 + true + ..\SrkToolkit.snk + + + + + + + + + SrkToolkit.snk + + + + + + PublicResXFileCodeGenerator + + + + diff --git a/Sources/NET4.SrkToolkit.Common/StringComparerEx.cs b/Sources/SrkToolkit.Common/StringComparerEx.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Common/StringComparerEx.cs rename to Sources/SrkToolkit.Common/StringComparerEx.cs diff --git a/Sources/NET4.SrkToolkit.Common/StringReplacer.cs b/Sources/SrkToolkit.Common/StringReplacer.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Common/StringReplacer.cs rename to Sources/SrkToolkit.Common/StringReplacer.cs diff --git a/Sources/NET4.SrkToolkit.Common/System.Collections.Generic/SrkIDictionaryExtensions.cs b/Sources/SrkToolkit.Common/System.Collections.Generic/SrkIDictionaryExtensions.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Common/System.Collections.Generic/SrkIDictionaryExtensions.cs rename to Sources/SrkToolkit.Common/System.Collections.Generic/SrkIDictionaryExtensions.cs diff --git a/Sources/NET4.SrkToolkit.Common/System.Collections.Generic/SrkIListExtensions.cs b/Sources/SrkToolkit.Common/System.Collections.Generic/SrkIListExtensions.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Common/System.Collections.Generic/SrkIListExtensions.cs rename to Sources/SrkToolkit.Common/System.Collections.Generic/SrkIListExtensions.cs diff --git a/Sources/NET4.SrkToolkit.Common/System.Collections.ObjectModel/SrkObservableCollectionExtensions.cs b/Sources/SrkToolkit.Common/System.Collections.ObjectModel/SrkObservableCollectionExtensions.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Common/System.Collections.ObjectModel/SrkObservableCollectionExtensions.cs rename to Sources/SrkToolkit.Common/System.Collections.ObjectModel/SrkObservableCollectionExtensions.cs diff --git a/Sources/NET4.SrkToolkit.Common/System.Collections.Specialized/SrkNameValueCollectionExtensions.cs b/Sources/SrkToolkit.Common/System.Collections.Specialized/SrkNameValueCollectionExtensions.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Common/System.Collections.Specialized/SrkNameValueCollectionExtensions.cs rename to Sources/SrkToolkit.Common/System.Collections.Specialized/SrkNameValueCollectionExtensions.cs diff --git a/Sources/NET4.SrkToolkit.Common/System.Collections/SrkIDictionaryExtensions.cs b/Sources/SrkToolkit.Common/System.Collections/SrkIDictionaryExtensions.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Common/System.Collections/SrkIDictionaryExtensions.cs rename to Sources/SrkToolkit.Common/System.Collections/SrkIDictionaryExtensions.cs diff --git a/Sources/NET4.SrkToolkit.Common/System.Diagnostics/StopwatchExtensions.cs b/Sources/SrkToolkit.Common/System.Diagnostics/StopwatchExtensions.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Common/System.Diagnostics/StopwatchExtensions.cs rename to Sources/SrkToolkit.Common/System.Diagnostics/StopwatchExtensions.cs diff --git a/Sources/NET4.SrkToolkit.Common/System.Linq/SrkEnumerable.cs b/Sources/SrkToolkit.Common/System.Linq/SrkEnumerable.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Common/System.Linq/SrkEnumerable.cs rename to Sources/SrkToolkit.Common/System.Linq/SrkEnumerable.cs diff --git a/Sources/NET4.SrkToolkit.Common/System/DateTimePrecision.cs b/Sources/SrkToolkit.Common/System/DateTimePrecision.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Common/System/DateTimePrecision.cs rename to Sources/SrkToolkit.Common/System/DateTimePrecision.cs diff --git a/Sources/NET4.SrkToolkit.Common/System/SrkArrayExtensions.cs b/Sources/SrkToolkit.Common/System/SrkArrayExtensions.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Common/System/SrkArrayExtensions.cs rename to Sources/SrkToolkit.Common/System/SrkArrayExtensions.cs diff --git a/Sources/NET4.SrkToolkit.Common/System/SrkDateTimeExtensions.cs b/Sources/SrkToolkit.Common/System/SrkDateTimeExtensions.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Common/System/SrkDateTimeExtensions.cs rename to Sources/SrkToolkit.Common/System/SrkDateTimeExtensions.cs diff --git a/Sources/NET4.SrkToolkit.Common/System/SrkExceptionExtensions.cs b/Sources/SrkToolkit.Common/System/SrkExceptionExtensions.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Common/System/SrkExceptionExtensions.cs rename to Sources/SrkToolkit.Common/System/SrkExceptionExtensions.cs diff --git a/Sources/NET4.SrkToolkit.Common/System/SrkStringExtensions.cs b/Sources/SrkToolkit.Common/System/SrkStringExtensions.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Common/System/SrkStringExtensions.cs rename to Sources/SrkToolkit.Common/System/SrkStringExtensions.cs diff --git a/Sources/NET4.SrkToolkit.Common/System/SrkTimeZoneInfoExtensions.cs b/Sources/SrkToolkit.Common/System/SrkTimeZoneInfoExtensions.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Common/System/SrkTimeZoneInfoExtensions.cs rename to Sources/SrkToolkit.Common/System/SrkTimeZoneInfoExtensions.cs diff --git a/Sources/NET4.SrkToolkit.Common/System/StringTransformer.Urls.cs b/Sources/SrkToolkit.Common/System/StringTransformer.Urls.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Common/System/StringTransformer.Urls.cs rename to Sources/SrkToolkit.Common/System/StringTransformer.Urls.cs diff --git a/Sources/NET4.SrkToolkit.Common/System/StringTransformer.cs b/Sources/SrkToolkit.Common/System/StringTransformer.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Common/System/StringTransformer.cs rename to Sources/SrkToolkit.Common/System/StringTransformer.cs diff --git a/Sources/NET4.SrkToolkit.Common/Testing/Assert.cs b/Sources/SrkToolkit.Common/Testing/Assert.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Common/Testing/Assert.cs rename to Sources/SrkToolkit.Common/Testing/Assert.cs diff --git a/Sources/NET4.SrkToolkit.Common/Threading.Tasks/TaskEx.cs b/Sources/SrkToolkit.Common/Threading.Tasks/TaskEx.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Common/Threading.Tasks/TaskEx.cs rename to Sources/SrkToolkit.Common/Threading.Tasks/TaskEx.cs diff --git a/Sources/NET4.SrkToolkit.Common/Validation/EmailAddressUtility.cs b/Sources/SrkToolkit.Common/Validation/EmailAddressUtility.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Common/Validation/EmailAddressUtility.cs rename to Sources/SrkToolkit.Common/Validation/EmailAddressUtility.cs diff --git a/Sources/NET4.SrkToolkit.Common/Validation/Validate.cs b/Sources/SrkToolkit.Common/Validation/Validate.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Common/Validation/Validate.cs rename to Sources/SrkToolkit.Common/Validation/Validate.cs diff --git a/Sources/NET4.SrkToolkit.Domain.AspMvc4/SrkToolkit.Web/MessageDisplayMode.cs b/Sources/SrkToolkit.Domain.AspNetCore2/MessageDisplayMode.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Domain.AspMvc4/SrkToolkit.Web/MessageDisplayMode.cs rename to Sources/SrkToolkit.Domain.AspNetCore2/MessageDisplayMode.cs diff --git a/Sources/NET4.SrkToolkit.Domain.AspMvc4/SrkToolkit.Web/SrkDomainControllerExtensions.cs b/Sources/SrkToolkit.Domain.AspNetCore2/SrkDomainControllerExtensions.cs similarity index 96% rename from Sources/NET4.SrkToolkit.Domain.AspMvc4/SrkToolkit.Web/SrkDomainControllerExtensions.cs rename to Sources/SrkToolkit.Domain.AspNetCore2/SrkDomainControllerExtensions.cs index 6207c73..8004188 100644 --- a/Sources/NET4.SrkToolkit.Domain.AspMvc4/SrkToolkit.Web/SrkDomainControllerExtensions.cs +++ b/Sources/SrkToolkit.Domain.AspNetCore2/SrkDomainControllerExtensions.cs @@ -16,12 +16,12 @@ namespace SrkToolkit.Web { + using Microsoft.AspNetCore.Mvc; + using SrkToolkit.Domain; using System; using System.Collections.Generic; using System.Linq; using System.Text; - using System.Web.Mvc; - using SrkToolkit.Domain; /// /// Extension methods for to use with actions. diff --git a/Sources/SrkToolkit.Domain.AspNetCore2/SrkToolkit.Domain.AspNetCore2.csproj b/Sources/SrkToolkit.Domain.AspNetCore2/SrkToolkit.Domain.AspNetCore2.csproj new file mode 100644 index 0000000..c0f6569 --- /dev/null +++ b/Sources/SrkToolkit.Domain.AspNetCore2/SrkToolkit.Domain.AspNetCore2.csproj @@ -0,0 +1,38 @@ + + + + net7.0 + enable + enable + SrkToolkit.Domain.AspNetCore2 + true + 2.0.0-preview1 + SandRock + SrkToolkit.Domain.AspNetCore2 contains extension methods for SrkToolkit.Domain in the context of a ASP MVC Core application. + https://github.com/sandrock/SrkToolkit/ + https://github.com/sandrock/SrkToolkit/blob/master/LICENSE + SrkToolkit domain AspMvcCore + 2.0.0.0 + 2.0.0.0 + true + ..\SrkToolkit.snk + + + + + SrkToolkit.snk + + + + + + + + + + + + + + + diff --git a/Sources/NET4.SrkToolkit.Domain.Tests/BaseRequestTests.cs b/Sources/SrkToolkit.Domain.CoreUnitTests/BaseRequestTests.cs similarity index 79% rename from Sources/NET4.SrkToolkit.Domain.Tests/BaseRequestTests.cs rename to Sources/SrkToolkit.Domain.CoreUnitTests/BaseRequestTests.cs index b509882..cd30e18 100644 --- a/Sources/NET4.SrkToolkit.Domain.Tests/BaseRequestTests.cs +++ b/Sources/SrkToolkit.Domain.CoreUnitTests/BaseRequestTests.cs @@ -16,21 +16,19 @@ namespace SrkToolkit.Domain.Tests { - using Microsoft.VisualStudio.TestTools.UnitTesting; using SrkToolkit.Domain; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.Serialization.Json; + using Xunit; - [TestClass] public class BaseRequestTests { - [TestClass] public class IsValidProperty { - [TestMethod] + [Fact] public void ReturnsTrueForEmptyModel() { // prepare @@ -40,15 +38,14 @@ public void ReturnsTrueForEmptyModel() var result = request.IsValid; // verify - Assert.IsTrue(result); + Assert.True(result); } } - [TestClass] public class AddValidationErrorMethod { - [TestMethod] + [Fact] public void AddingErrorWorks() { // prepare @@ -58,10 +55,10 @@ public void AddingErrorWorks() request.AddValidationError("test"); // verify - Assert.AreEqual(1, request.AllValidationErrors.Count()); + Assert.Equal(1, request.AllValidationErrors.Count()); } - [TestMethod] + [Fact] public void AddingErrorBeforeValidationKeepsTheErrorAfterValidation() { // prepare @@ -71,15 +68,14 @@ public void AddingErrorBeforeValidationKeepsTheErrorAfterValidation() request.AddValidationError("test"); // verify - Assert.IsFalse(request.IsValid); - Assert.AreEqual(1, request.AllValidationErrors.Count()); + Assert.False(request.IsValid); + Assert.Equal(1, request.AllValidationErrors.Count()); } } - [TestClass] public class Serialization { - [TestMethod] + [Fact] public void DataContractJsonSerializerSerializesAllProperties() { var target = new Request1(); @@ -89,7 +85,7 @@ public void DataContractJsonSerializerSerializesAllProperties() serializer.WriteObject(stream, target); stream.Seek(0L, SeekOrigin.Begin); var unserialized = (Request1)serializer.ReadObject(stream); - Assert.AreEqual(target.Id, unserialized.Id); + Assert.Equal(target.Id, unserialized.Id); } } diff --git a/Sources/NET4.SrkToolkit.Domain.Tests/BaseResultTests.cs b/Sources/SrkToolkit.Domain.CoreUnitTests/BaseResultTests.cs similarity index 75% rename from Sources/NET4.SrkToolkit.Domain.Tests/BaseResultTests.cs rename to Sources/SrkToolkit.Domain.CoreUnitTests/BaseResultTests.cs index 3e82e1c..99466a3 100644 --- a/Sources/NET4.SrkToolkit.Domain.Tests/BaseResultTests.cs +++ b/Sources/SrkToolkit.Domain.CoreUnitTests/BaseResultTests.cs @@ -1,83 +1,81 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace SrkToolkit.Domain.Tests -{ - using Microsoft.VisualStudio.TestTools.UnitTesting; - using SrkToolkit.Domain; - using System; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Runtime.Serialization.Json; - - [TestClass] - public class BaseResultTests - { - [TestClass] - public class Serialization - { - [TestMethod] - public void DataContractJsonSerializerSerializesAllProperties() - { - var targetRequest = new Request1(); - targetRequest.Id = "42"; - var targetResult = new Result1(targetRequest); - targetResult.Id = "42"; - targetResult.Succeed = true; - targetResult.Errors.AddDetail(Error1.Error42, "The detail.", "The error to all failed algorithms."); - var serializer = new DataContractJsonSerializer(typeof(Result1)); - var stream = new MemoryStream(); - serializer.WriteObject(stream, targetResult); - stream.Seek(0L, SeekOrigin.Begin); - var unserialized = (Result1)serializer.ReadObject(stream); - Assert.AreEqual(targetResult.Succeed, unserialized.Succeed); - Assert.AreEqual(targetResult.Id, unserialized.Id); - Assert.AreEqual(targetResult.Request.Id, unserialized.Request.Id); - Assert.AreEqual(targetResult.Errors.Count, unserialized.Errors.Count); - Assert.AreEqual(targetResult.Errors[0].Code, unserialized.Errors[0].Code); - Assert.AreEqual(targetResult.Errors[0].DisplayMessage, unserialized.Errors[0].DisplayMessage); - Assert.AreEqual(targetResult.Errors[0].Detail, unserialized.Errors[0].Detail); - } - } - - public class Request1 : BaseRequest - { - public string Id { get; set; } - } - - public class Result1 : BaseResult - { - public Result1() - { - } - - public Result1(Request1 request) - : base(request) - { - } - - public string Id { get; set; } - } - - public enum Error1 - { - Unknown, - Error42, - IAmNotATeapot, - } - } -} +// +// Copyright 2014 SandRock +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +namespace SrkToolkit.Domain.Tests +{ + using SrkToolkit.Domain; + using System; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Runtime.Serialization.Json; + using Xunit; + + public class BaseResultTests + { + public class Serialization + { + [Fact] + public void DataContractJsonSerializerSerializesAllProperties() + { + var targetRequest = new Request1(); + targetRequest.Id = "42"; + var targetResult = new Result1(targetRequest); + targetResult.Id = "42"; + targetResult.Succeed = true; + targetResult.Errors.AddDetail(Error1.Error42, "The detail.", "The error to all failed algorithms."); + var serializer = new DataContractJsonSerializer(typeof(Result1)); + var stream = new MemoryStream(); + serializer.WriteObject(stream, targetResult); + stream.Seek(0L, SeekOrigin.Begin); + var unserialized = (Result1)serializer.ReadObject(stream); + Assert.Equal(targetResult.Succeed, unserialized.Succeed); + Assert.Equal(targetResult.Id, unserialized.Id); + Assert.Equal(targetResult.Request.Id, unserialized.Request.Id); + Assert.Equal(targetResult.Errors.Count, unserialized.Errors.Count); + Assert.Equal(targetResult.Errors[0].Code, unserialized.Errors[0].Code); + Assert.Equal(targetResult.Errors[0].DisplayMessage, unserialized.Errors[0].DisplayMessage); + Assert.Equal(targetResult.Errors[0].Detail, unserialized.Errors[0].Detail); + } + } + + public class Request1 : BaseRequest + { + public string Id { get; set; } + } + + public class Result1 : BaseResult + { + public Result1() + { + } + + public Result1(Request1 request) + : base(request) + { + } + + public string Id { get; set; } + } + + public enum Error1 + { + Unknown, + Error42, + IAmNotATeapot, + } + } +} diff --git a/Sources/NET4.SrkToolkit.Domain.Tests/BasicResultTests.cs b/Sources/SrkToolkit.Domain.CoreUnitTests/BasicResultTests.cs similarity index 86% rename from Sources/NET4.SrkToolkit.Domain.Tests/BasicResultTests.cs rename to Sources/SrkToolkit.Domain.CoreUnitTests/BasicResultTests.cs index 8c05a4a..a15fbf0 100644 --- a/Sources/NET4.SrkToolkit.Domain.Tests/BasicResultTests.cs +++ b/Sources/SrkToolkit.Domain.CoreUnitTests/BasicResultTests.cs @@ -16,20 +16,18 @@ namespace SrkToolkit.Domain.Tests { + using SrkToolkit.Domain; using System; using System.Collections.Generic; using System.Linq; using System.Text; - using Microsoft.VisualStudio.TestTools.UnitTesting; - using SrkToolkit.Domain; + using Xunit; - [TestClass] public class BasicResultTests { - [TestClass] public class AddExtension { - [TestMethod] + [Fact] public void EnumValue() { var value = Lalala.One; @@ -38,7 +36,7 @@ public void EnumValue() IList list = new List(); list.Add(value, resourceManager); var result = list[0].DisplayMessage; - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } } diff --git a/Sources/NET4.SrkToolkit.Domain.Tests/ResultErrorExtensionsTests.cs b/Sources/SrkToolkit.Domain.CoreUnitTests/ResultErrorExtensionsTests.cs similarity index 60% rename from Sources/NET4.SrkToolkit.Domain.Tests/ResultErrorExtensionsTests.cs rename to Sources/SrkToolkit.Domain.CoreUnitTests/ResultErrorExtensionsTests.cs index d5c59ef..53d25eb 100644 --- a/Sources/NET4.SrkToolkit.Domain.Tests/ResultErrorExtensionsTests.cs +++ b/Sources/SrkToolkit.Domain.CoreUnitTests/ResultErrorExtensionsTests.cs @@ -16,44 +16,42 @@ namespace SrkToolkit.Domain.Tests { - using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; using System.Linq; + using Xunit; - [TestClass] public class ResultErrorExtensionsTests { - [TestClass] public class AddMethod { - [TestMethod] + [Fact] public void Overload1() { var result = new Result1(new Request1()); var code = Error1.Hello; var message = "bad error"; result.Errors.Add(code, message); - Assert.AreEqual(1, result.Errors.Count); - Assert.AreEqual(code, result.Errors[0].Code); - Assert.AreEqual(message, result.Errors[0].DisplayMessage); - Assert.IsNull(result.Errors[0].Detail); + Assert.Equal(1, result.Errors.Count); + Assert.Equal(code, result.Errors[0].Code); + Assert.Equal(message, result.Errors[0].DisplayMessage); + Assert.Null(result.Errors[0].Detail); } - [TestMethod] + [Fact] public void Overload2() { var result = new Result1(new Request1()); var code = Error1.Hello; var message = "Error1 Hello"; result.Errors.Add(code, Strings.ResourceManager); - Assert.AreEqual(1, result.Errors.Count); - Assert.AreEqual(code, result.Errors[0].Code); - Assert.AreEqual(message, result.Errors[0].DisplayMessage); - Assert.IsNull(result.Errors[0].Detail); + Assert.Equal(1, result.Errors.Count); + Assert.Equal(code, result.Errors[0].Code); + Assert.Equal(message, result.Errors[0].DisplayMessage); + Assert.Null(result.Errors[0].Detail); } - [TestMethod] + [Fact] public void Overload1_Format() { var result = new Result1(new Request1()); @@ -61,13 +59,13 @@ public void Overload1_Format() var format = "Mlivej"; var message = @"WorldCode """ + format + @""""; result.Errors.Add(code, @"WorldCode ""{0}""", format); - Assert.AreEqual(1, result.Errors.Count); - Assert.AreEqual(code, result.Errors[0].Code); - Assert.AreEqual(message, result.Errors[0].DisplayMessage); - Assert.IsNull(result.Errors[0].Detail); + Assert.Equal(1, result.Errors.Count); + Assert.Equal(code, result.Errors[0].Code); + Assert.Equal(message, result.Errors[0].DisplayMessage); + Assert.Null(result.Errors[0].Detail); } - [TestMethod] + [Fact] public void Overload2_Format() { var result = new Result1(new Request1()); @@ -75,17 +73,16 @@ public void Overload2_Format() var format = "Mlivej"; var message = @"WorldCode """ + format + @""""; result.Errors.Add(code, Strings.ResourceManager, format); - Assert.AreEqual(1, result.Errors.Count); - Assert.AreEqual(code, result.Errors[0].Code); - Assert.AreEqual(message, result.Errors[0].DisplayMessage); - Assert.IsNull(result.Errors[0].Detail); + Assert.Equal(1, result.Errors.Count); + Assert.Equal(code, result.Errors[0].Code); + Assert.Equal(message, result.Errors[0].DisplayMessage); + Assert.Null(result.Errors[0].Detail); } } - [TestClass] public class AddDetailMethod { - [TestMethod] + [Fact] public void Overload1() { var result = new Result1(new Request1()); @@ -93,13 +90,13 @@ public void Overload1() var message = "bad error"; var detail = "Glarg"; result.Errors.AddDetail(code, detail, message); - Assert.AreEqual(1, result.Errors.Count); - Assert.AreEqual(code, result.Errors[0].Code); - Assert.AreEqual(message, result.Errors[0].DisplayMessage); - Assert.AreEqual(detail, result.Errors[0].Detail); + Assert.Equal(1, result.Errors.Count); + Assert.Equal(code, result.Errors[0].Code); + Assert.Equal(message, result.Errors[0].DisplayMessage); + Assert.Equal(detail, result.Errors[0].Detail); } - [TestMethod] + [Fact] public void Overload2() { var result = new Result1(new Request1()); @@ -107,13 +104,13 @@ public void Overload2() var message = "Error1 Hello"; var detail = "Glarg"; result.Errors.AddDetail(code, detail, Strings.ResourceManager); - Assert.AreEqual(1, result.Errors.Count); - Assert.AreEqual(code, result.Errors[0].Code); - Assert.AreEqual(message, result.Errors[0].DisplayMessage); - Assert.AreEqual(detail, result.Errors[0].Detail); + Assert.Equal(1, result.Errors.Count); + Assert.Equal(code, result.Errors[0].Code); + Assert.Equal(message, result.Errors[0].DisplayMessage); + Assert.Equal(detail, result.Errors[0].Detail); } - [TestMethod] + [Fact] public void Overload1_Format() { var result = new Result1(new Request1()); @@ -122,13 +119,13 @@ public void Overload1_Format() var message = @"WorldCode """ + format + @""""; var detail = "Glarg"; result.Errors.AddDetail(code, detail, @"WorldCode ""{0}""", format); - Assert.AreEqual(1, result.Errors.Count); - Assert.AreEqual(code, result.Errors[0].Code); - Assert.AreEqual(message, result.Errors[0].DisplayMessage); - Assert.AreEqual(detail, result.Errors[0].Detail); + Assert.Equal(1, result.Errors.Count); + Assert.Equal(code, result.Errors[0].Code); + Assert.Equal(message, result.Errors[0].DisplayMessage); + Assert.Equal(detail, result.Errors[0].Detail); } - [TestMethod] + [Fact] public void Overload2_Format() { var result = new Result1(new Request1()); @@ -137,10 +134,10 @@ public void Overload2_Format() var message = @"WorldCode """ + format + @""""; var detail = "Glarg"; result.Errors.AddDetail(code, detail, Strings.ResourceManager, format); - Assert.AreEqual(1, result.Errors.Count); - Assert.AreEqual(code, result.Errors[0].Code); - Assert.AreEqual(message, result.Errors[0].DisplayMessage); - Assert.AreEqual(detail, result.Errors[0].Detail); + Assert.Equal(1, result.Errors.Count); + Assert.Equal(code, result.Errors[0].Code); + Assert.Equal(message, result.Errors[0].DisplayMessage); + Assert.Equal(detail, result.Errors[0].Detail); } } diff --git a/Sources/NET4.SrkToolkit.Domain.Tests/ResultErrorTests.cs b/Sources/SrkToolkit.Domain.CoreUnitTests/ResultErrorTests.cs similarity index 73% rename from Sources/NET4.SrkToolkit.Domain.Tests/ResultErrorTests.cs rename to Sources/SrkToolkit.Domain.CoreUnitTests/ResultErrorTests.cs index 06cd00a..dbbf5c6 100644 --- a/Sources/NET4.SrkToolkit.Domain.Tests/ResultErrorTests.cs +++ b/Sources/SrkToolkit.Domain.CoreUnitTests/ResultErrorTests.cs @@ -20,80 +20,81 @@ namespace SrkToolkit.Domain.Tests using System.Collections.Generic; using System.Linq; using System.Text; - using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Resources; + using Xunit; public class ResultErrorTests { - [TestClass] public class Ctor { - [TestMethod] + [Fact] public void WithResourceManager() { var value = Lalala.One; var resourceManager = Strings.ResourceManager; var expected = "Hello World"; var result = new ResultError(value, resourceManager); - Assert.AreEqual(value, result.Code); - Assert.AreEqual(expected, result.DisplayMessage); + Assert.Equal(value, result.Code); + Assert.Equal(expected, result.DisplayMessage); } - [TestMethod] + [Fact] public void WithoutResourceManager() { var value = Lalala.One; var resourceManager = "Hello World"; var expected = "Hello World"; var result = new ResultError(value, resourceManager); - Assert.AreEqual(value, result.Code); - Assert.AreEqual(expected, result.DisplayMessage); + Assert.Equal(value, result.Code); + Assert.Equal(expected, result.DisplayMessage); } - [TestMethod] + [Fact] public void WithResourceManagerAndFormat() { var value = Lalala.Infinity; var resourceManager = Strings.ResourceManager; var expected = "here is a format => aabb <="; var result = new ResultError(value, resourceManager, "aabb"); - Assert.AreEqual(value, result.Code); - Assert.AreEqual(expected, result.DisplayMessage); + Assert.Equal(value, result.Code); + Assert.Equal(expected, result.DisplayMessage); } - [TestMethod] + [Fact] public void WithoutResourceManagerAndFormat() { var value = Lalala.Infinity; var resourceManager = "here is a format => {0} <="; var expected = "here is a format => aabb <="; var result = new ResultError(value, resourceManager, "aabb"); - Assert.AreEqual(value, result.Code); - Assert.AreEqual(expected, result.DisplayMessage); + Assert.Equal(value, result.Code); + Assert.Equal(expected, result.DisplayMessage); } - [TestMethod] + [Fact] public void WithNestedType() { var value = NestedClass.Lululu.One; var resourceManager = Strings.ResourceManager; var expected = "Hello World"; var result = new ResultError(value, resourceManager); - Assert.AreEqual(value, result.Code); - Assert.AreEqual(expected, result.DisplayMessage); + Assert.Equal(value, result.Code); + Assert.Equal(expected, result.DisplayMessage); } } - [TestClass] public class AddExtension { - [TestMethod, ExpectedException(typeof(ArgumentNullException))] + [Fact] public void ThrowsIfArg0IsNull() { - ResultErrorExtensions.Add(default(IList>), Lalala.Many, Strings.ResourceManager); + Assert.Throws(() => + { + ResultErrorExtensions.Add(default(IList>), Lalala.Many, Strings.ResourceManager); + }); } - [TestMethod] + [Fact] public void Works() { var value = Lalala.One; @@ -102,10 +103,10 @@ public void Works() var list = new List>(); list.Add(value, resourceManager); var result = list[0].DisplayMessage; - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void Format() { var value = Lalala.Infinity; @@ -114,40 +115,41 @@ public void Format() var list = new List>(); list.Add(value, resourceManager, "test"); var result = list[0].DisplayMessage; - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } } - [TestClass] public class ContainsErrorExtension { - [TestMethod] + [Fact] public void ReturnsFalseIfCodeIsNotPresent() { var errors = new List>(); errors.Add(new ResultError(Lalala.One, Strings.ResourceManager)); - Assert.IsFalse(ResultErrorExtensions.ContainsError(errors, Lalala.Many)); + Assert.False(ResultErrorExtensions.ContainsError(errors, Lalala.Many)); } - [TestMethod] + [Fact] public void ReturnsTrueIfCodeIsNotPresent() { var errors = new List>(); errors.Add(new ResultError(Lalala.One, Strings.ResourceManager)); - Assert.IsTrue(ResultErrorExtensions.ContainsError(errors, Lalala.One)); + Assert.True(ResultErrorExtensions.ContainsError(errors, Lalala.One)); } - [TestMethod, ExpectedException(typeof(ArgumentNullException))] + [Fact] public void ThrowsIfArg0IsNull() { - ResultErrorExtensions.ContainsError(default(IList>), Lalala.Many); + Assert.Throws(() => + { + ResultErrorExtensions.ContainsError(default(IList>), Lalala.Many); + }); } } - [TestClass] public class WithPostProcessExtension { - [TestMethod] + [Fact] public void Works() { var value = Lalala.One; @@ -156,10 +158,10 @@ public void Works() var list = new List>(); list.WithPostProcess(str => "[" + str + "]").Add(value, resourceManager); var result = list[0].DisplayMessage; - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } - [TestMethod] + [Fact] public void Format() { var value = Lalala.Infinity; @@ -168,7 +170,7 @@ public void Format() var list = new List>(); list.WithPostProcess(str => "[" + str + "]").Add(value, resourceManager, "test"); var result = list[0].DisplayMessage; - Assert.AreEqual(expected, result); + Assert.Equal(expected, result); } } diff --git a/Sources/SrkToolkit.Domain.CoreUnitTests/SrkToolkit.Domain.CoreUnitTests.csproj b/Sources/SrkToolkit.Domain.CoreUnitTests/SrkToolkit.Domain.CoreUnitTests.csproj new file mode 100644 index 0000000..d65a961 --- /dev/null +++ b/Sources/SrkToolkit.Domain.CoreUnitTests/SrkToolkit.Domain.CoreUnitTests.csproj @@ -0,0 +1,35 @@ + + + + net7.0 + disable + disable + + false + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + + + + + + PublicResXFileCodeGenerator + + + + diff --git a/Sources/NET4.SrkToolkit.Domain.Tests/Strings.Designer.cs b/Sources/SrkToolkit.Domain.CoreUnitTests/Strings.Designer.cs similarity index 95% rename from Sources/NET4.SrkToolkit.Domain.Tests/Strings.Designer.cs rename to Sources/SrkToolkit.Domain.CoreUnitTests/Strings.Designer.cs index 8bc663b..9869010 100644 --- a/Sources/NET4.SrkToolkit.Domain.Tests/Strings.Designer.cs +++ b/Sources/SrkToolkit.Domain.CoreUnitTests/Strings.Designer.cs @@ -1,7 +1,6 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -39,7 +38,7 @@ internal Strings() { public static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SrkToolkit.Domain.Tests.Strings", typeof(Strings).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SrkToolkit.Domain.CoreUnitTests.Strings", typeof(Strings).Assembly); resourceMan = temp; } return resourceMan; diff --git a/Sources/NET4.SrkToolkit.Domain.Tests/Strings.resx b/Sources/SrkToolkit.Domain.CoreUnitTests/Strings.resx similarity index 100% rename from Sources/NET4.SrkToolkit.Domain.Tests/Strings.resx rename to Sources/SrkToolkit.Domain.CoreUnitTests/Strings.resx diff --git a/Sources/NET4.SrkToolkit.Domain/BaseRequest.cs b/Sources/SrkToolkit.Domain/BaseRequest.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Domain/BaseRequest.cs rename to Sources/SrkToolkit.Domain/BaseRequest.cs diff --git a/Sources/NET4.SrkToolkit.Domain/BaseResult.cs b/Sources/SrkToolkit.Domain/BaseResult.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Domain/BaseResult.cs rename to Sources/SrkToolkit.Domain/BaseResult.cs diff --git a/Sources/NET4.SrkToolkit.Domain/BasicResult.TResultCode.Payload.cs b/Sources/SrkToolkit.Domain/BasicResult.TResultCode.Payload.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Domain/BasicResult.TResultCode.Payload.cs rename to Sources/SrkToolkit.Domain/BasicResult.TResultCode.Payload.cs diff --git a/Sources/NET4.SrkToolkit.Domain/BasicResult.TResultCode.cs b/Sources/SrkToolkit.Domain/BasicResult.TResultCode.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Domain/BasicResult.TResultCode.cs rename to Sources/SrkToolkit.Domain/BasicResult.TResultCode.cs diff --git a/Sources/NET4.SrkToolkit.Domain/BasicResult.cs b/Sources/SrkToolkit.Domain/BasicResult.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Domain/BasicResult.cs rename to Sources/SrkToolkit.Domain/BasicResult.cs diff --git a/Sources/NET4.SrkToolkit.Domain/BasicResultError.cs b/Sources/SrkToolkit.Domain/BasicResultError.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Domain/BasicResultError.cs rename to Sources/SrkToolkit.Domain/BasicResultError.cs diff --git a/Sources/NET4.SrkToolkit.Domain/BasicResultExtensions.cs b/Sources/SrkToolkit.Domain/BasicResultExtensions.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Domain/BasicResultExtensions.cs rename to Sources/SrkToolkit.Domain/BasicResultExtensions.cs diff --git a/Sources/NET4.SrkToolkit.Domain/IBaseResult.cs b/Sources/SrkToolkit.Domain/IBaseResult.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Domain/IBaseResult.cs rename to Sources/SrkToolkit.Domain/IBaseResult.cs diff --git a/Sources/NET4.SrkToolkit.Domain/IResultError.cs b/Sources/SrkToolkit.Domain/IResultError.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Domain/IResultError.cs rename to Sources/SrkToolkit.Domain/IResultError.cs diff --git a/Sources/NET4.SrkToolkit.Domain/Internals/Names.cs b/Sources/SrkToolkit.Domain/Internals/Names.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Domain/Internals/Names.cs rename to Sources/SrkToolkit.Domain/Internals/Names.cs diff --git a/Sources/NET4.SrkToolkit.Domain/ResultError.cs b/Sources/SrkToolkit.Domain/ResultError.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Domain/ResultError.cs rename to Sources/SrkToolkit.Domain/ResultError.cs diff --git a/Sources/NET4.SrkToolkit.Domain/ResultErrorExtensions.cs b/Sources/SrkToolkit.Domain/ResultErrorExtensions.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Domain/ResultErrorExtensions.cs rename to Sources/SrkToolkit.Domain/ResultErrorExtensions.cs diff --git a/Sources/SrkToolkit.Domain/SrkToolkit.Domain.csproj b/Sources/SrkToolkit.Domain/SrkToolkit.Domain.csproj new file mode 100644 index 0000000..0629771 --- /dev/null +++ b/Sources/SrkToolkit.Domain/SrkToolkit.Domain.csproj @@ -0,0 +1,33 @@ + + + + disable + disable + net46;net7.0;netstandard2.0 + 9 + true + 2.0.0-preview1 + SandRock + SrkToolkit.Domain is used in your domain layer to provider RPC-style request and result classes. + https://github.com/sandrock/SrkToolkit/ + https://github.com/sandrock/SrkToolkit/blob/master/LICENSE + SrkToolkit domain + 2.0.0.0 + 2.0.0.0 + true + ..\SrkToolkit.snk + + + + + SrkToolkit.snk + + + + + + Internals\EnumTools.cs + + + + diff --git a/Sources/NET4.SrkToolkit.Web/NavigationLine.cs b/Sources/SrkToolkit.Web.AspMvc5/NavigationLine.cs similarity index 94% rename from Sources/NET4.SrkToolkit.Web/NavigationLine.cs rename to Sources/SrkToolkit.Web.AspMvc5/NavigationLine.cs index ad12cd6..35d09ad 100644 --- a/Sources/NET4.SrkToolkit.Web/NavigationLine.cs +++ b/Sources/SrkToolkit.Web.AspMvc5/NavigationLine.cs @@ -14,7 +14,7 @@ // limitations under the License. // -namespace SrkToolkit.Web +namespace SrkToolkit.Web.Open { using System; using System.Collections.Generic; diff --git a/Sources/NET4.SrkToolkit.Web/NavigationLineEntry.cs b/Sources/SrkToolkit.Web.AspMvc5/NavigationLineEntry.cs similarity index 94% rename from Sources/NET4.SrkToolkit.Web/NavigationLineEntry.cs rename to Sources/SrkToolkit.Web.AspMvc5/NavigationLineEntry.cs index d238e2b..b83b589 100644 --- a/Sources/NET4.SrkToolkit.Web/NavigationLineEntry.cs +++ b/Sources/SrkToolkit.Web.AspMvc5/NavigationLineEntry.cs @@ -14,7 +14,7 @@ // limitations under the License. // -namespace SrkToolkit.Web +namespace SrkToolkit.Web.Open { using System; using System.Collections.Generic; diff --git a/Sources/NET4.SrkToolkit.Web/Open/OpenGraphName.cs b/Sources/SrkToolkit.Web.AspMvc5/Open/OpenGraphName.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Web/Open/OpenGraphName.cs rename to Sources/SrkToolkit.Web.AspMvc5/Open/OpenGraphName.cs diff --git a/Sources/NET4.SrkToolkit.Web/Open/OpenGraphNamespace.cs b/Sources/SrkToolkit.Web.AspMvc5/Open/OpenGraphNamespace.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Web/Open/OpenGraphNamespace.cs rename to Sources/SrkToolkit.Web.AspMvc5/Open/OpenGraphNamespace.cs diff --git a/Sources/NET4.SrkToolkit.Web/Open/OpenGraphObject.cs b/Sources/SrkToolkit.Web.AspMvc5/Open/OpenGraphObject.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Web/Open/OpenGraphObject.cs rename to Sources/SrkToolkit.Web.AspMvc5/Open/OpenGraphObject.cs diff --git a/Sources/NET4.SrkToolkit.Web/Open/OpenGraphTag.cs b/Sources/SrkToolkit.Web.AspMvc5/Open/OpenGraphTag.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Web/Open/OpenGraphTag.cs rename to Sources/SrkToolkit.Web.AspMvc5/Open/OpenGraphTag.cs diff --git a/Sources/NET4.SrkToolkit.Web/Open/PageInfo.cs b/Sources/SrkToolkit.Web.AspMvc5/Open/PageInfo.cs similarity index 96% rename from Sources/NET4.SrkToolkit.Web/Open/PageInfo.cs rename to Sources/SrkToolkit.Web.AspMvc5/Open/PageInfo.cs index 98f9e4f..b8da317 100644 --- a/Sources/NET4.SrkToolkit.Web/Open/PageInfo.cs +++ b/Sources/SrkToolkit.Web.AspMvc5/Open/PageInfo.cs @@ -21,7 +21,12 @@ namespace SrkToolkit.Web.Open using System.Globalization; using System.Linq; using System.Text; + +#if ASPMVCCORE + +#else using System.Web.Mvc; +#endif /// /// Helps attach descriptors to a page in order to generate meta/link tags. diff --git a/Sources/NET4.SrkToolkit.Web/Open/PageInfoItem.cs b/Sources/SrkToolkit.Web.AspMvc5/Open/PageInfoItem.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Web/Open/PageInfoItem.cs rename to Sources/SrkToolkit.Web.AspMvc5/Open/PageInfoItem.cs diff --git a/Sources/NET4.SrkToolkit.Web/Open/PageInfoObject.cs b/Sources/SrkToolkit.Web.AspMvc5/Open/PageInfoObject.cs similarity index 93% rename from Sources/NET4.SrkToolkit.Web/Open/PageInfoObject.cs rename to Sources/SrkToolkit.Web.AspMvc5/Open/PageInfoObject.cs index 3555f68..55e3452 100644 --- a/Sources/NET4.SrkToolkit.Web/Open/PageInfoObject.cs +++ b/Sources/SrkToolkit.Web.AspMvc5/Open/PageInfoObject.cs @@ -16,11 +16,17 @@ namespace SrkToolkit.Web.Open { + using Microsoft.AspNetCore.Mvc.Rendering; using System; using System.Collections.Generic; using System.Linq; using System.Text; + +#if ASPMVCCORE + +#else using System.Web.Mvc; +#endif /// /// A HTML element that will represent a page information . @@ -74,6 +80,8 @@ public OpenGraphTag OpenGraphTag get { return this.openGraphTag; } } +#if ASPNETCORE +#endif #if !NSTD && !NET40 private TagBuilder Tag { @@ -90,7 +98,8 @@ private TagBuilder Tag if (this.tagValue != null) { - tag.SetInnerText(this.tagValue); + ////tag.SetInnerText(this.tagValue); // net40 + tag.InnerHtml.Append(this.tagValue); // netstandard2.0 } return tag; @@ -217,7 +226,11 @@ public override string ToString() } else if (tag != null) { +#if ASPMVCCORE + return tag.ToString(); +#else return tag.ToString(singleTagNames.Contains(this.tagName) ? TagRenderMode.SelfClosing : TagRenderMode.Normal); +#endif } else { diff --git a/Sources/NET4.SrkToolkit.Web/Open/SrkOpenGraphHtmlExtensions.cs b/Sources/SrkToolkit.Web.AspMvc5/Open/SrkOpenGraphHtmlExtensions.cs similarity index 90% rename from Sources/NET4.SrkToolkit.Web/Open/SrkOpenGraphHtmlExtensions.cs rename to Sources/SrkToolkit.Web.AspMvc5/Open/SrkOpenGraphHtmlExtensions.cs index 090a162..ff5d04b 100644 --- a/Sources/NET4.SrkToolkit.Web/Open/SrkOpenGraphHtmlExtensions.cs +++ b/Sources/SrkToolkit.Web.AspMvc5/Open/SrkOpenGraphHtmlExtensions.cs @@ -20,8 +20,15 @@ namespace SrkToolkit.Web.Open using System.Collections.Generic; using System.Linq; using System.Text; + +#if ASPMVCCORE + +#else using System.Web.Mvc; +#endif +#if ASPMVCCORE +#else /// /// TODO: Update summary. /// @@ -34,4 +41,5 @@ public SrkOpenGraphHtmlExtensions(HtmlHelper html) this.html = html; } } +#endif } diff --git a/Sources/NET4.SrkToolkit.Web/SrkRequestExtensions.cs b/Sources/SrkToolkit.Web.AspMvc5/SrkRequestExtensions.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Web/SrkRequestExtensions.cs rename to Sources/SrkToolkit.Web.AspMvc5/SrkRequestExtensions.cs diff --git a/Sources/SrkToolkit.Web.AspMvc5/SrkToolkit.Web.AspMvc5.csproj b/Sources/SrkToolkit.Web.AspMvc5/SrkToolkit.Web.AspMvc5.csproj new file mode 100644 index 0000000..8fab804 --- /dev/null +++ b/Sources/SrkToolkit.Web.AspMvc5/SrkToolkit.Web.AspMvc5.csproj @@ -0,0 +1,26 @@ + + + + disable + disable + net45;net46 + 9 + + + + + + + + + + + + + + + + + + + diff --git a/Sources/NET4.SrkToolkit.Web/Fakes/BasicHttpContext.cs b/Sources/SrkToolkit.Web.AspNetCore2/Fakes/BasicHttpContext.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Web/Fakes/BasicHttpContext.cs rename to Sources/SrkToolkit.Web.AspNetCore2/Fakes/BasicHttpContext.cs diff --git a/Sources/NET4.SrkToolkit.Web/Fakes/BasicHttpRequest.cs b/Sources/SrkToolkit.Web.AspNetCore2/Fakes/BasicHttpRequest.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Web/Fakes/BasicHttpRequest.cs rename to Sources/SrkToolkit.Web.AspNetCore2/Fakes/BasicHttpRequest.cs diff --git a/Sources/NET4.SrkToolkit.Web/Fakes/BasicHttpSessionState.cs b/Sources/SrkToolkit.Web.AspNetCore2/Fakes/BasicHttpSessionState.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Web/Fakes/BasicHttpSessionState.cs rename to Sources/SrkToolkit.Web.AspNetCore2/Fakes/BasicHttpSessionState.cs diff --git a/Sources/NET4.SrkToolkit.Web/Filters/AuthorizeAttribute.cs b/Sources/SrkToolkit.Web.AspNetCore2/Filters/AuthorizeAttribute.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Web/Filters/AuthorizeAttribute.cs rename to Sources/SrkToolkit.Web.AspNetCore2/Filters/AuthorizeAttribute.cs diff --git a/Sources/NET4.SrkToolkit.Web/HttpErrors/BaseErrorController.cs b/Sources/SrkToolkit.Web.AspNetCore2/HttpErrors/BaseErrorController.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Web/HttpErrors/BaseErrorController.cs rename to Sources/SrkToolkit.Web.AspNetCore2/HttpErrors/BaseErrorController.cs diff --git a/Sources/NET4.SrkToolkit.Web/HttpErrors/BasicHttpErrorResponse.cs b/Sources/SrkToolkit.Web.AspNetCore2/HttpErrors/BasicHttpErrorResponse.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Web/HttpErrors/BasicHttpErrorResponse.cs rename to Sources/SrkToolkit.Web.AspNetCore2/HttpErrors/BasicHttpErrorResponse.cs diff --git a/Sources/NET4.SrkToolkit.Web/HttpErrors/ErrorControllerHandler.cs b/Sources/SrkToolkit.Web.AspNetCore2/HttpErrors/ErrorControllerHandler.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Web/HttpErrors/ErrorControllerHandler.cs rename to Sources/SrkToolkit.Web.AspNetCore2/HttpErrors/ErrorControllerHandler.cs diff --git a/Sources/NET4.SrkToolkit.Web/HttpErrors/IErrorController.cs b/Sources/SrkToolkit.Web.AspNetCore2/HttpErrors/IErrorController.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Web/HttpErrors/IErrorController.cs rename to Sources/SrkToolkit.Web.AspNetCore2/HttpErrors/IErrorController.cs diff --git a/Sources/SrkToolkit.Web.AspNetCore2/Internals.cs b/Sources/SrkToolkit.Web.AspNetCore2/Internals.cs new file mode 100644 index 0000000..2a32da7 --- /dev/null +++ b/Sources/SrkToolkit.Web.AspNetCore2/Internals.cs @@ -0,0 +1,9 @@ + +namespace SrkToolkit.Web +{ + using System; + + internal static class Internals + { + } +} diff --git a/Sources/NET4.SrkToolkit.Web/JsonNetResult.cs b/Sources/SrkToolkit.Web.AspNetCore2/JsonNetResult.cs similarity index 94% rename from Sources/NET4.SrkToolkit.Web/JsonNetResult.cs rename to Sources/SrkToolkit.Web.AspNetCore2/JsonNetResult.cs index 5a0e508..6c24f8c 100644 --- a/Sources/NET4.SrkToolkit.Web/JsonNetResult.cs +++ b/Sources/SrkToolkit.Web.AspNetCore2/JsonNetResult.cs @@ -16,6 +16,7 @@ namespace SrkToolkit.Web { + using Microsoft.AspNetCore.Mvc; using System; using System.Diagnostics; using System.Runtime.Serialization.Json; @@ -59,7 +60,7 @@ public JsonNetResult() /// /// The JSON serializer. /// - public static Action Serializer { get; set; } + public static Action Serializer { get; set; } /// /// Gets or sets the content encoding. diff --git a/Sources/NET4.SrkToolkit.Web/Models/HttpErrorModel.cs b/Sources/SrkToolkit.Web.AspNetCore2/Models/HttpErrorModel.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Web/Models/HttpErrorModel.cs rename to Sources/SrkToolkit.Web.AspNetCore2/Models/HttpErrorModel.cs diff --git a/Sources/NET4.SrkToolkit.Web/Models/TempMessage.cs b/Sources/SrkToolkit.Web.AspNetCore2/Models/TempMessage.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Web/Models/TempMessage.cs rename to Sources/SrkToolkit.Web.AspNetCore2/Models/TempMessage.cs diff --git a/Sources/NET4.SrkToolkit.Web/Mvc/DecimalModelBinder.cs b/Sources/SrkToolkit.Web.AspNetCore2/Mvc/DecimalModelBinder.cs similarity index 96% rename from Sources/NET4.SrkToolkit.Web/Mvc/DecimalModelBinder.cs rename to Sources/SrkToolkit.Web.AspNetCore2/Mvc/DecimalModelBinder.cs index c91a0c1..ecdee11 100644 --- a/Sources/NET4.SrkToolkit.Web/Mvc/DecimalModelBinder.cs +++ b/Sources/SrkToolkit.Web.AspNetCore2/Mvc/DecimalModelBinder.cs @@ -16,6 +16,8 @@ namespace SrkToolkit.Web.Mvc { + using Microsoft.AspNetCore.Mvc; + using Microsoft.AspNetCore.Mvc.ModelBinding; using System; using System.Collections.Generic; using System.Linq; diff --git a/Sources/SrkToolkit.Web.AspNetCore2/Mvc/Dummy.cs b/Sources/SrkToolkit.Web.AspNetCore2/Mvc/Dummy.cs new file mode 100644 index 0000000..bf10d3e --- /dev/null +++ b/Sources/SrkToolkit.Web.AspNetCore2/Mvc/Dummy.cs @@ -0,0 +1,12 @@ + +namespace SrkToolkit.Web.Mvc; + +using System; + +/// +/// Preserve namespace. +/// +public static class Dummy +{ + +} diff --git a/Sources/NET4.SrkToolkit.Web/Mvc/IntegerModelBinder.cs b/Sources/SrkToolkit.Web.AspNetCore2/Mvc/IntegerModelBinder.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Web/Mvc/IntegerModelBinder.cs rename to Sources/SrkToolkit.Web.AspNetCore2/Mvc/IntegerModelBinder.cs diff --git a/Sources/NET4.SrkToolkit.Web/Services/BaseSessionService.cs b/Sources/SrkToolkit.Web.AspNetCore2/Services/BaseSessionService.cs similarity index 96% rename from Sources/NET4.SrkToolkit.Web/Services/BaseSessionService.cs rename to Sources/SrkToolkit.Web.AspNetCore2/Services/BaseSessionService.cs index 07f589e..03f9054 100644 --- a/Sources/NET4.SrkToolkit.Web/Services/BaseSessionService.cs +++ b/Sources/SrkToolkit.Web.AspNetCore2/Services/BaseSessionService.cs @@ -19,7 +19,6 @@ namespace SrkToolkit.Web.Services using System; using System.Collections.Generic; using System.Linq; - using System.Web; /// /// diff --git a/Sources/NET4.SrkToolkit.Web/Services/DictionarySessionServiceSource.cs b/Sources/SrkToolkit.Web.AspNetCore2/Services/DictionarySessionServiceSource.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Web/Services/DictionarySessionServiceSource.cs rename to Sources/SrkToolkit.Web.AspNetCore2/Services/DictionarySessionServiceSource.cs diff --git a/Sources/NET4.SrkToolkit.Web/Services/HttpBaseSessionServiceSource.cs b/Sources/SrkToolkit.Web.AspNetCore2/Services/HttpBaseSessionServiceSource.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Web/Services/HttpBaseSessionServiceSource.cs rename to Sources/SrkToolkit.Web.AspNetCore2/Services/HttpBaseSessionServiceSource.cs diff --git a/Sources/NET4.SrkToolkit.Web/Services/IResultService.cs b/Sources/SrkToolkit.Web.AspNetCore2/Services/IResultService.cs similarity index 96% rename from Sources/NET4.SrkToolkit.Web/Services/IResultService.cs rename to Sources/SrkToolkit.Web.AspNetCore2/Services/IResultService.cs index cd3f3c9..9e9fca5 100644 --- a/Sources/NET4.SrkToolkit.Web/Services/IResultService.cs +++ b/Sources/SrkToolkit.Web.AspNetCore2/Services/IResultService.cs @@ -16,11 +16,11 @@ namespace SrkToolkit.Web.Services { + using Microsoft.AspNetCore.Mvc; using System; using System.Collections.Generic; using System.Linq; using System.Text; - using System.Web.Mvc; /// /// Helps return generic HTTP responses. diff --git a/Sources/NET4.SrkToolkit.Web/Services/ISessionServiceSource.cs b/Sources/SrkToolkit.Web.AspNetCore2/Services/ISessionServiceSource.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Web/Services/ISessionServiceSource.cs rename to Sources/SrkToolkit.Web.AspNetCore2/Services/ISessionServiceSource.cs diff --git a/Sources/NET4.SrkToolkit.Web/Services/ResultService.cs b/Sources/SrkToolkit.Web.AspNetCore2/Services/ResultService.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Web/Services/ResultService.cs rename to Sources/SrkToolkit.Web.AspNetCore2/Services/ResultService.cs diff --git a/Sources/NET4.SrkToolkit.Web/Services/ResultServiceBase.cs b/Sources/SrkToolkit.Web.AspNetCore2/Services/ResultServiceBase.cs similarity index 94% rename from Sources/NET4.SrkToolkit.Web/Services/ResultServiceBase.cs rename to Sources/SrkToolkit.Web.AspNetCore2/Services/ResultServiceBase.cs index ede399e..3cee128 100644 --- a/Sources/NET4.SrkToolkit.Web/Services/ResultServiceBase.cs +++ b/Sources/SrkToolkit.Web.AspNetCore2/Services/ResultServiceBase.cs @@ -16,18 +16,17 @@ namespace SrkToolkit.Web.Services { - using System; - using System.Web; - using System.Web.Mvc; - using System.Web.Routing; + using Microsoft.AspNetCore.Http; + using Microsoft.AspNetCore.Mvc; using SrkToolkit.Web.HttpErrors; + using System; /// /// Helps return generic HTTP responses. /// public class ResultServiceBase { - private readonly HttpContextBase httpContext; + private readonly HttpContext httpContext; public const string RouteDataExceptionKey = "error"; public const string RouteDataMessageKey = "message"; @@ -39,7 +38,7 @@ public class ResultServiceBase /// Initializes a new instance of the class. /// /// The HTTP context. - public ResultServiceBase(HttpContextBase httpContext) + public ResultServiceBase(HttpContext httpContext) { this.httpContext = httpContext; } diff --git a/Sources/NET4.SrkToolkit.Web/SrkControllerExtensions.cs b/Sources/SrkToolkit.Web.AspNetCore2/SrkControllerExtensions.cs similarity index 95% rename from Sources/NET4.SrkToolkit.Web/SrkControllerExtensions.cs rename to Sources/SrkToolkit.Web.AspNetCore2/SrkControllerExtensions.cs index fe2f5e2..f2236a8 100644 --- a/Sources/NET4.SrkToolkit.Web/SrkControllerExtensions.cs +++ b/Sources/SrkToolkit.Web.AspNetCore2/SrkControllerExtensions.cs @@ -16,14 +16,13 @@ namespace SrkToolkit.Web { + using Microsoft.AspNetCore.Mvc; + using Microsoft.AspNetCore.Routing; using SrkToolkit.Web.Open; using System; using System.Collections.Generic; using System.Linq; using System.Text; - using System.Web.Caching; - using System.Web.Mvc; - using System.Web.Routing; /// /// Extension methods for the class. @@ -38,7 +37,7 @@ public static class SrkControllerExtensions /// /// The control. /// - public static SrkToolkit.Web.NavigationLine NavigationLine(this Controller ctrl) + public static NavigationLine NavigationLine(this Controller ctrl) { if (ctrl.HttpContext == null) throw new ArgumentNullException("HttpContext is not set", "ctrl"); @@ -52,7 +51,7 @@ public static SrkToolkit.Web.NavigationLine NavigationLine(this Controller ctrl) return line; } - +/* /// /// Gets an item from the HTTP cache. /// @@ -103,7 +102,7 @@ public static T GetFromCache(this Controller ctrl, TimeSpan duration, CacheIt return value; } - +*//* /// /// Clears an item from the HTTP cache. /// @@ -148,7 +147,7 @@ public static T ClearFromCache(this Controller ctrl) return null; } - +*/ /// /// Gets a action result that will redirect the user to the specified local path. Fallbacks to a second path. Then fallbacks to /Home/Index /// @@ -177,7 +176,7 @@ public static ActionResult RedirectToLocal(this Controller controller, string lo return new RedirectToRouteResult(values); } } - +/* /// /// Gets the first valid local URL from the method arguments. /// @@ -216,7 +215,7 @@ public static string GetAnyLocalUrl(this Controller controller, string url1, boo return null; } - +*/ /// /// Helps attach descriptors to a page in order to generate meta/link tags. /// diff --git a/Sources/NET4.SrkToolkit.Web/System.Web.Mvc/SrkHtmlExtensions.cs b/Sources/SrkToolkit.Web.AspNetCore2/SrkHtmlExtensions.cs similarity index 82% rename from Sources/NET4.SrkToolkit.Web/System.Web.Mvc/SrkHtmlExtensions.cs rename to Sources/SrkToolkit.Web.AspNetCore2/SrkHtmlExtensions.cs index 20c2e89..274eda3 100644 --- a/Sources/NET4.SrkToolkit.Web/System.Web.Mvc/SrkHtmlExtensions.cs +++ b/Sources/SrkToolkit.Web.AspNetCore2/SrkHtmlExtensions.cs @@ -16,15 +16,20 @@ namespace System.Web.Mvc { + using Microsoft.AspNetCore.Html; + using Microsoft.AspNetCore.Mvc.ModelBinding; + using Microsoft.AspNetCore.Mvc.Rendering; + using Microsoft.AspNetCore.Mvc.ViewFeatures; + using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal; + using Microsoft.AspNetCore.Routing; + using SrkToolkit.AspNetCore; + using SrkToolkit.Web; + using SrkToolkit.Web.Open; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Linq.Expressions; - using System.Web.Mvc.Html; - using System.Web.Routing; - using SrkToolkit.Web.Open; - using SrkToolkit.Web; using System.Globalization; /// @@ -57,7 +62,7 @@ public static class SrkHtmlExtensions /// /// /// - public static HtmlHelper SetTimezone(this HtmlHelper html, string timeZoneName) + public static IHtmlHelper SetTimezone(this IHtmlHelper html, string timeZoneName) { if (string.IsNullOrEmpty(timeZoneName)) throw new ArgumentException("The value cannot be empty", "timeZoneName"); @@ -73,7 +78,7 @@ public static HtmlHelper SetTimezone(this HtmlHelper html, string timeZoneName) /// The time zone. /// /// - public static HtmlHelper SetTimezone(this HtmlHelper html, TimeZoneInfo timeZone) + public static IHtmlHelper SetTimezone(this IHtmlHelper html, TimeZoneInfo timeZone) { if (html == null) throw new ArgumentNullException("html"); @@ -90,7 +95,7 @@ public static HtmlHelper SetTimezone(this HtmlHelper html, TimeZoneInfo timeZone /// The HTML. /// /// html - public static TimeZoneInfo GetTimezone(this HtmlHelper html) + public static TimeZoneInfo GetTimezone(this IHtmlHelper html) { if (html == null) throw new ArgumentNullException("html"); @@ -107,7 +112,7 @@ public static TimeZoneInfo GetTimezone(this HtmlHelper html) /// The date. /// The specified in the UTC time zone. /// The specified in the user's time zone. - public static DateTime GetUserDate(this HtmlHelper html, DateTime date, out DateTime utcDate) + public static DateTime GetUserDate(this IHtmlHelper html, DateTime date, out DateTime utcDate) { var tz = html.GetTimezone(); if (date.Kind == DateTimeKind.Utc) @@ -137,7 +142,7 @@ public static DateTime GetUserDate(this HtmlHelper html, DateTime date, out Date /// The date. /// The specified in the UTC time zone. /// DateTime.Kind ' + date.Kind + ' is not supported - public static DateTime GetUtcDate(this HtmlHelper html, DateTime date) + public static DateTime GetUtcDate(this IHtmlHelper html, DateTime date) { if (date.Kind == DateTimeKind.Utc) { @@ -164,7 +169,7 @@ public static DateTime GetUtcDate(this HtmlHelper html, DateTime date) /// /// /// - public static HtmlHelper SetCulture(this HtmlHelper html, string culture) + public static IHtmlHelper SetCulture(this IHtmlHelper html, string culture) { if (string.IsNullOrEmpty(culture)) throw new ArgumentException("The value cannot be empty", "culture"); @@ -180,7 +185,7 @@ public static HtmlHelper SetCulture(this HtmlHelper html, string culture) /// The culture. /// /// - public static HtmlHelper SetCulture(this HtmlHelper html, CultureInfo culture) + public static IHtmlHelper SetCulture(this IHtmlHelper html, CultureInfo culture) { if (html == null) throw new ArgumentNullException("html"); @@ -197,7 +202,7 @@ public static HtmlHelper SetCulture(this HtmlHelper html, CultureInfo culture) /// The HTML. /// /// html - public static CultureInfo GetCulture(this HtmlHelper html) + public static CultureInfo GetCulture(this IHtmlHelper html) { if (html == null) throw new ArgumentNullException("html"); @@ -215,7 +220,7 @@ public static CultureInfo GetCulture(this HtmlHelper html) /// /// /// - public static HtmlHelper SetUICulture(this HtmlHelper html, string uICulture) + public static IHtmlHelper SetUICulture(this IHtmlHelper html, string uICulture) { if (string.IsNullOrEmpty(uICulture)) throw new ArgumentException("The value cannot be empty", "culture"); @@ -231,7 +236,7 @@ public static HtmlHelper SetUICulture(this HtmlHelper html, string uICulture) /// The culture. /// /// - public static HtmlHelper SetUICulture(this HtmlHelper html, CultureInfo uICulture) + public static IHtmlHelper SetUICulture(this IHtmlHelper html, CultureInfo uICulture) { if (html == null) throw new ArgumentNullException("html"); @@ -248,7 +253,7 @@ public static HtmlHelper SetUICulture(this HtmlHelper html, CultureInfo uICultur /// The HTML. /// /// html - public static CultureInfo GetUICulture(this HtmlHelper html) + public static CultureInfo GetUICulture(this IHtmlHelper html) { if (html == null) throw new ArgumentNullException("html"); @@ -259,7 +264,7 @@ public static CultureInfo GetUICulture(this HtmlHelper html) } #region Display date/time - +/* /// /// Sets the date and time formats. /// @@ -278,7 +283,7 @@ public static CultureInfo GetUICulture(this HtmlHelper html) /// html.ViewContext /// or /// html.ViewContext.HttpContext - public static HtmlHelper SetDateTimeFormats(this HtmlHelper html, string dateFormat = null, string dateTzFormat = null, string timeFormat = null, string timeTzFormat = null, string timespanFormat = null, string dateTimeFormat = null, string shortTimeFormat = null, string shortTimespanFormat = null) + public static IHtmlHelper SetDateTimeFormats(this IHtmlHelper html, string dateFormat = null, string dateTzFormat = null, string timeFormat = null, string timeTzFormat = null, string timespanFormat = null, string dateTimeFormat = null, string shortTimeFormat = null, string shortTimespanFormat = null) { if (html == null) throw new ArgumentNullException("html"); @@ -292,7 +297,7 @@ public static HtmlHelper SetDateTimeFormats(this HtmlHelper html, string dateFor return html; } - +*/ /// /// Gets the date and time formats. /// @@ -305,7 +310,7 @@ public static HtmlHelper SetDateTimeFormats(this HtmlHelper html, string dateFor /// or /// html.ViewContext.HttpContext /// - public static string[] GetDateTimeFormats(this HtmlHelper html) + public static string[] GetDateTimeFormats(this IHtmlHelper html) { if (html == null) throw new ArgumentNullException("html"); @@ -328,7 +333,7 @@ public static string[] GetDateTimeFormats(this HtmlHelper html) /// The display value (use to manualy set the display value). /// The display date format (use to change the default display value format). /// - public static MvcHtmlString DisplayDateTime(this HtmlHelper html, DateTime date, bool useTimeTag = true, string display = null, string displayDateFormat = null) + public static HtmlString DisplayDateTime(this IHtmlHelper html, DateTime date, bool useTimeTag = true, string display = null, string displayDateFormat = null) { var defaultFormat = html.GetDateTimeFormats()[5]; DateTime utc; @@ -345,11 +350,11 @@ public static MvcHtmlString DisplayDateTime(this HtmlHelper html, DateTime date, utc.ToString("O"), userDate.ToString("G"), GetDateClasses(utc) + "display-datetime"); - return MvcHtmlString.Create(tag); + return new HtmlString(tag); } else { - return MvcHtmlString.Create(display); + return new HtmlString(display); } } @@ -385,7 +390,7 @@ private static string GetDateClasses(DateTimeOffset date) /// The display value (use to manualy set the display value). /// The display date format (use to change the default display value format). /// - public static MvcHtmlString DisplayDate(this HtmlHelper html, DateTime date, bool useTimeTag = true, string display = null, string displayDateFormat = null) + public static HtmlString DisplayDate(this IHtmlHelper html, DateTime date, bool useTimeTag = true, string display = null, string displayDateFormat = null) { DateTime utc; DateTime userDate = html.GetUserDate(date, out utc); @@ -402,11 +407,11 @@ public static MvcHtmlString DisplayDate(this HtmlHelper html, DateTime date, boo utc.ToString("O"), userDate.ToString("D"), GetDateClasses(utc) + "display-date"); - return MvcHtmlString.Create(tag); + return new HtmlString(tag); } else { - return MvcHtmlString.Create(display); + return new HtmlString(display); } } @@ -419,7 +424,7 @@ public static MvcHtmlString DisplayDate(this HtmlHelper html, DateTime date, boo /// The display value (use to manualy set the display value). /// The display date format (use to change the default display value format). /// - public static MvcHtmlString DisplayDate(this HtmlHelper html, DateTimeOffset date, bool useTimeTag = true, string display = null, string displayDateFormat = null) + public static HtmlString DisplayDate(this IHtmlHelper html, DateTimeOffset date, bool useTimeTag = true, string display = null, string displayDateFormat = null) { var defaultFormat = html.GetDateTimeFormats()[1]; string displayTime = date.ToString(displayDateFormat ?? defaultFormat); @@ -434,11 +439,11 @@ public static MvcHtmlString DisplayDate(this HtmlHelper html, DateTimeOffset dat date.ToUniversalTime().ToString("O"), date.ToString("D zzz"), GetDateClasses(date) + "display-date"); - return MvcHtmlString.Create(tag); + return new HtmlString(tag); } else { - return MvcHtmlString.Create(display); + return new HtmlString(display); } } @@ -451,7 +456,7 @@ public static MvcHtmlString DisplayDate(this HtmlHelper html, DateTimeOffset dat /// The display value (use to manualy set the display value). /// The display date format (use to change the default display value format). /// - public static MvcHtmlString DisplayTime(this HtmlHelper html, DateTime date, bool useTimeTag = true, string display = null, string displayDateFormat = null) + public static HtmlString DisplayTime(this IHtmlHelper html, DateTime date, bool useTimeTag = true, string display = null, string displayDateFormat = null) { DateTime utc; DateTime userDate = html.GetUserDate(date, out utc); @@ -468,11 +473,11 @@ public static MvcHtmlString DisplayTime(this HtmlHelper html, DateTime date, boo utc.ToString("O"), userDate.ToString("G"), GetDateClasses(utc) + "display-time"); - return MvcHtmlString.Create(tag); + return new HtmlString(tag); } else { - return MvcHtmlString.Create(display); + return new HtmlString(display); } } @@ -485,7 +490,7 @@ public static MvcHtmlString DisplayTime(this HtmlHelper html, DateTime date, boo /// The display value (use to manualy set the display value). /// The display date format (use to change the default display value format). /// - public static MvcHtmlString DisplayTime(this HtmlHelper html, DateTimeOffset date, bool useTimeTag = true, string display = null, string displayDateFormat = null) + public static HtmlString DisplayTime(this IHtmlHelper html, DateTimeOffset date, bool useTimeTag = true, string display = null, string displayDateFormat = null) { var defaultFormat = html.GetDateTimeFormats()[3]; string displayTime = date.ToLocalTime().ToString(displayDateFormat ?? defaultFormat); @@ -500,11 +505,11 @@ public static MvcHtmlString DisplayTime(this HtmlHelper html, DateTimeOffset dat date.ToUniversalTime().ToString("O"), date.ToString("R"), GetDateClasses(date) + "display-time"); - return MvcHtmlString.Create(tag); + return new HtmlString(tag); } else { - return MvcHtmlString.Create(display); + return new HtmlString(display); } } @@ -517,7 +522,7 @@ public static MvcHtmlString DisplayTime(this HtmlHelper html, DateTimeOffset dat /// The display value (use to manualy set the display value). /// The display date format (use to change the default display value format). /// - public static MvcHtmlString DisplayTime(this HtmlHelper html, TimeSpan date, bool useTimeTag = true, string display = null, string displayDateFormat = null) + public static HtmlString DisplayTime(this IHtmlHelper html, TimeSpan date, bool useTimeTag = true, string display = null, string displayDateFormat = null) { var defaultFormat = html.GetDateTimeFormats()[4]; string displayTime = date.ToString(displayDateFormat ?? defaultFormat); @@ -532,11 +537,11 @@ public static MvcHtmlString DisplayTime(this HtmlHelper html, TimeSpan date, boo date.ToString("c"), date.ToString("c"), "display-time"); - return MvcHtmlString.Create(tag); + return new HtmlString(tag); } else { - return MvcHtmlString.Create(display); + return new HtmlString(display); } } @@ -547,7 +552,7 @@ public static MvcHtmlString DisplayTime(this HtmlHelper html, TimeSpan date, boo /// The date. /// The precision. /// - public static MvcHtmlString JsDate(this HtmlHelper html, DateTime date, DateTimePrecision precision = DateTimePrecision.Second) + public static HtmlString JsDate(this IHtmlHelper html, DateTime date, DateTimePrecision precision = DateTimePrecision.Second) { DateTime utc = SrkHtmlExtensions.GetUtcDate(html, date); /* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date @@ -562,7 +567,7 @@ public static MvcHtmlString JsDate(this HtmlHelper html, DateTime date, DateTime string value = "new Date(" + (utc.ToPrecision(precision).Subtract(UnixEpoch).TotalMilliseconds).ToString("F0") + ")"; - return MvcHtmlString.Create(value); + return new HtmlString(value); } /// @@ -573,7 +578,7 @@ public static MvcHtmlString JsDate(this HtmlHelper html, DateTime date, DateTime /// if set to true the date will be enclsoed in a <time> tag. /// The display value (use to manualy set the display value). /// - public static MvcHtmlString DisplayShortTime(this HtmlHelper html, DateTime date, bool useTimeTag = true, string display = null) + public static HtmlString DisplayShortTime(this IHtmlHelper html, DateTime date, bool useTimeTag = true, string display = null) { var defaultFormat = html.GetDateTimeFormats()[6]; return html.DisplayTime(date, useTimeTag, display, displayDateFormat: defaultFormat); @@ -587,7 +592,7 @@ public static MvcHtmlString DisplayShortTime(this HtmlHelper html, DateTime date /// if set to true the date will be enclsoed in a <time> tag. /// The display value (use to manualy set the display value). /// - public static MvcHtmlString DisplayShortTime(this HtmlHelper html, TimeSpan date, bool useTimeTag = true, string display = null) + public static HtmlString DisplayShortTime(this IHtmlHelper html, TimeSpan date, bool useTimeTag = true, string display = null) { var defaultFormat = html.GetDateTimeFormats()[7]; return html.DisplayTime(date, useTimeTag, display, displayDateFormat: defaultFormat); @@ -606,10 +611,10 @@ public static MvcHtmlString DisplayShortTime(this HtmlHelper html, TimeSpan date /// The class attribute to associate to <a> tags (defaults to "external"). /// The target attribute to associate to <a> tags (default to "_blank"). /// - public static MvcHtmlString LineBreaks(this HtmlHelper html, string content, bool makeLinks = false, string linkClasses = "external accentColor", string linkTarget = "_self") + public static HtmlString LineBreaks(this IHtmlHelper html, string content, bool makeLinks = false, string linkClasses = "external accentColor", string linkTarget = "_self") { if (content == null) - return MvcHtmlString.Create(string.Empty); + return new HtmlString(string.Empty); content = content.ProperHtmlEscape(); @@ -620,7 +625,7 @@ public static MvcHtmlString LineBreaks(this HtmlHelper html, string content, boo content = content.AddHtmlLineBreaks(); - return MvcHtmlString.Create(content); + return new HtmlString(content); } /// @@ -631,7 +636,7 @@ public static MvcHtmlString LineBreaks(this HtmlHelper html, string content, boo /// The number of characters desired. /// The ending string (used only if trim occured). /// - public static string TrimText(this HtmlHelper html, string text, int chars, string ending = "...") + public static string TrimText(this IHtmlHelper html, string text, int chars, string ending = "...") { return text.TrimTextRight(chars, ending); } @@ -654,10 +659,10 @@ public static string TrimText(this HtmlHelper html, string text, int chars, stri /// /// an escaped HTML string /// - public static MvcHtmlString DisplayText(this HtmlHelper html, string content, bool makeLinks = true, bool makeParagraphs = true, bool makeLineBreaks = true, bool twitterLinks = false, string linksClass = "external", string linksTarget = "_blank", string wrapClass = null) + public static HtmlString DisplayText(this IHtmlHelper html, string content, bool makeLinks = true, bool makeParagraphs = true, bool makeLineBreaks = true, bool twitterLinks = false, string linksClass = "external", string linksTarget = "_blank", string wrapClass = null) { if (content == null) - return MvcHtmlString.Create(string.Empty); + return new HtmlString(string.Empty); content = content.ProperHtmlEscape(); @@ -673,15 +678,15 @@ public static MvcHtmlString DisplayText(this HtmlHelper html, string content, bo content = content.AddHtmlLineBreaks(); if (wrapClass == null) - return MvcHtmlString.Create(content); + return new HtmlString(content); else - return MvcHtmlString.Create("
" + content + "
"); + return new HtmlString("
" + content + "
"); } #endregion #endregion - +/* /// /// Returns many HTML radio buttons for the specified list and selected value. /// @@ -691,12 +696,12 @@ public static MvcHtmlString DisplayText(this HtmlHelper html, string content, bo /// The model expression. /// The list of values. /// - public static MvcHtmlString RadioButtonSelectList( - this HtmlHelper htmlHelper, + public static HtmlString RadioButtonSelectList( + this IHtmlHelper IHtmlHelper, Expression> expression, IEnumerable listOfValues) { - var metaData = ModelMetadata.FromLambdaExpression(expression, htmlHelper.ViewData); + var metaData = ModelMetadata.FromLambdaExpression(expression, IHtmlHelper.ViewData); var sb = new StringBuilder(); if (listOfValues != null) @@ -709,8 +714,8 @@ public static MvcHtmlString RadioButtonSelectList( var id = metaData.PropertyName + "_" + item.Value; // Create and populate a radio button using the existing html helpers - var label = htmlHelper.Label(id, HttpUtility.HtmlEncode(item.Text)); - var radio = htmlHelper.RadioButtonFor(expression, item.Value, new { id = id }).ToHtmlString(); + var label = IHtmlHelper.Label(id, HttpUtility.HtmlEncode(item.Text)); + var radio = IHtmlHelper.RadioButtonFor(expression, item.Value, new { id = id }).ToHtmlString(); // Create the html string that will be returned to the client // e.g. @@ -718,32 +723,32 @@ public static MvcHtmlString RadioButtonSelectList( } } - return MvcHtmlString.Create(sb.ToString()); + return new HtmlString(sb.ToString()); } - +*/ #region GetFullHtmlFieldName - public static string GetFullHtmlFieldName(this HtmlHelper helper, Expression> expression) + public static string GetFullHtmlFieldName(this IHtmlHelper helper, Expression> expression) { return helper.ViewData.TemplateInfo.GetFullHtmlFieldName(expression); } - - public static string GetFullHtmlFieldId(this HtmlHelper helper, Expression> expression) +/* + public static string GetFullHtmlFieldId(this IHtmlHelper helper, Expression> expression) { return helper.ViewData.TemplateInfo.GetFullHtmlFieldId(expression); } - +*/ public static string GetFullHtmlFieldName(this TemplateInfo templateInfo, Expression> expression) { return templateInfo.GetFullHtmlFieldName(ExpressionHelper.GetExpressionText(expression)); } - +/* public static string GetFullHtmlFieldId(this TemplateInfo templateInfo, Expression> expression) { return templateInfo.GetFullHtmlFieldId(ExpressionHelper.GetExpressionText(expression)); } - - public static string GetFullHtmlFieldDisplayName(this HtmlHelper helper, Expression> expression) +*/ + public static string GetFullHtmlFieldDisplayName(this IHtmlHelper helper, Expression> expression) { var propertyName = helper.GetFullHtmlFieldName(expression); @@ -754,6 +759,7 @@ public static string GetFullHtmlFieldDisplayName(this HtmlHel #region DescriptionFor +/* /// /// Returns an HTML span element and the property name of the property that is represented by the specified expression. /// @@ -762,13 +768,12 @@ public static string GetFullHtmlFieldDisplayName(this HtmlHel /// The HTML helper instance that this method extends. /// An expression that identifies the property to display. /// An HTML span element and the property name of the property that is represented by the specified expression - public static MvcHtmlString DescriptionFor( - this HtmlHelper helper, + public static HtmlString DescriptionFor( + this IHtmlHelper helper, Expression> expression) { return DescriptionFor(helper, expression, null, null); } - /// /// Returns an HTML span element and the property name of the property that is represented by the specified expression. /// @@ -780,8 +785,8 @@ public static MvcHtmlString DescriptionFor( /// /// An HTML span element and the property name of the property that is represented by the specified expression /// - public static MvcHtmlString DescriptionFor( - this HtmlHelper helper, + public static HtmlString DescriptionFor( + this IHtmlHelper helper, Expression> expression, object htmlAttributes) { @@ -799,14 +804,14 @@ public static MvcHtmlString DescriptionFor( /// /// An HTML span element and the property name of the property that is represented by the specified expression /// - public static MvcHtmlString DescriptionFor( - this HtmlHelper helper, + public static HtmlString DescriptionFor( + this IHtmlHelper helper, Expression> expression, IDictionary htmlAttributes) { return DescriptionFor(helper, expression, null, htmlAttributes); } - +*//* /// /// Returns an HTML span element and the property name of the property that is represented by the specified expression. /// @@ -819,8 +824,8 @@ public static MvcHtmlString DescriptionFor( /// /// An HTML span element and the property name of the property that is represented by the specified expression /// - public static MvcHtmlString DescriptionFor( - this HtmlHelper helper, + public static HtmlString DescriptionFor( + this IHtmlHelper helper, Expression> expression, string descriptionText, IDictionary htmlAttributes) @@ -829,31 +834,32 @@ public static MvcHtmlString DescriptionFor( var value = descriptionText.NullIfEmpty() ?? meta.Description.NullIfEmpty(); if (string.IsNullOrEmpty(value)) - return MvcHtmlString.Empty; + return HtmlString.Empty; var htmlFieldName = ExpressionHelper.GetExpressionText(expression); var id = TagBuilder.CreateSanitizedId(helper.ViewContext.ViewData.TemplateInfo.GetFullHtmlFieldName(htmlFieldName)); var tag = new TagBuilder("span"); tag.Attributes.Add("data-for", id); tag.MergeAttributes(htmlAttributes, true); - tag.SetInnerText(value); + ////tag.SetInnerText(value); // AspNet + tag.InnerHtml.Append(value); // AspNetCore? return tag.ToMvcHtmlString(TagRenderMode.Normal); } - +*/ #endregion #region BeginFormEx - +/* /// /// Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by an action method. /// /// The HTML helper. /// An object that contains the HTML attributes to set for the element. /// An opening <form> tag. - public static MvcForm BeginFormEx(this HtmlHelper htmlHelper, object htmlAttributes) + public static MvcForm BeginFormEx(this IHtmlHelper IHtmlHelper, object htmlAttributes) { - string rawUrl = htmlHelper.ViewContext.HttpContext.Request.RawUrl; - return htmlHelper.BeginForm(null, null, htmlHelper.ViewContext.RouteData.Values, FormMethod.Post, new RouteValueDictionary(htmlAttributes) as IDictionary); + string rawUrl = IHtmlHelper.ViewContext.HttpContext.Request.RawUrl; + return IHtmlHelper.BeginForm(null, null, IHtmlHelper.ViewContext.RouteData.Values, FormMethod.Post, new RouteValueDictionary(htmlAttributes) as IDictionary); } /// @@ -863,28 +869,28 @@ public static MvcForm BeginFormEx(this HtmlHelper htmlHelper, object htmlAttribu /// An object that contains the HTML attributes to set for the element. /// An object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. This object is typically created by using object initializer syntax. /// An opening <form> tag. - public static MvcForm BeginFormEx(this HtmlHelper htmlHelper, object htmlAttributes, object routeValues) + public static MvcForm BeginFormEx(this IHtmlHelper IHtmlHelper, object htmlAttributes, object routeValues) { - string rawUrl = htmlHelper.ViewContext.HttpContext.Request.RawUrl; - return htmlHelper.BeginForm(null, null, routeValues, FormMethod.Post, htmlAttributes); + string rawUrl = IHtmlHelper.ViewContext.HttpContext.Request.RawUrl; + return IHtmlHelper.BeginForm(null, null, routeValues, FormMethod.Post, htmlAttributes); } - +*/ #endregion #region Submit - +/* /// /// Returns a submit input element by using the specified HTML helper and the name of the form field. /// /// The HTML. /// The value. /// An input element whose type attribute is set to "submit". - public static MvcHtmlString Submit(this HtmlHelper html, string value) + public static HtmlString Submit(this IHtmlHelper html, string value) { var builder = new TagBuilder("input"); builder.MergeAttribute("type", "submit"); builder.MergeAttribute("value", value); - return new MvcHtmlString(builder.ToString(TagRenderMode.SelfClosing)); + return new HtmlString(builder.ToString(TagRenderMode.SelfClosing)); } /// @@ -894,13 +900,13 @@ public static MvcHtmlString Submit(this HtmlHelper html, string value) /// The value. /// The name. /// An input element whose type attribute is set to "submit". - public static MvcHtmlString Submit(this HtmlHelper html, string value, string name) + public static HtmlString Submit(this IHtmlHelper html, string value, string name) { var builder = new TagBuilder("input"); builder.MergeAttribute("type", "submit"); builder.MergeAttribute("name", name); builder.MergeAttribute("value", value); - return new MvcHtmlString(builder.ToString(TagRenderMode.SelfClosing)); + return new HtmlString(builder.ToString(TagRenderMode.SelfClosing)); } /// @@ -911,7 +917,7 @@ public static MvcHtmlString Submit(this HtmlHelper html, string value, string na /// The name. /// An object that contains the HTML attributes to set for the element. /// An input element whose type attribute is set to "submit". - public static MvcHtmlString Submit(this HtmlHelper html, string value, string name, object htmlAttributes) + public static HtmlString Submit(this IHtmlHelper html, string value, string name, object htmlAttributes) { var attributes = HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes); var builder = new TagBuilder("input"); @@ -919,25 +925,25 @@ public static MvcHtmlString Submit(this HtmlHelper html, string value, string na builder.MergeAttribute("type", "submit"); builder.MergeAttribute("name", name); builder.MergeAttribute("value", value); - return new MvcHtmlString(builder.ToString(TagRenderMode.SelfClosing)); + return new HtmlString(builder.ToString(TagRenderMode.SelfClosing)); } - +*/ #endregion #region File - +/* /// /// Returns a file input element by using the specified HTML helper and the name of the form field. /// /// The HTML. /// The name. /// An input element whose type attribute is set to "file". - public static MvcHtmlString File(this HtmlHelper html, string name) + public static HtmlString File(this IHtmlHelper html, string name) { var builder = new TagBuilder("input"); builder.MergeAttribute("type", "file"); builder.MergeAttribute("name", name); - return new MvcHtmlString(builder.ToString(TagRenderMode.SelfClosing)); + return new HtmlString(builder.ToString(TagRenderMode.SelfClosing)); } /// @@ -947,34 +953,34 @@ public static MvcHtmlString File(this HtmlHelper html, string name) /// The name. /// An object that contains the HTML attributes to set for the element. /// An input element whose type attribute is set to "file". - public static MvcHtmlString File(this HtmlHelper html, string name, object htmlAttributes) + public static HtmlString File(this IHtmlHelper html, string name, object htmlAttributes) { var attributes = HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes); var builder = new TagBuilder("input"); builder.MergeAttributes(attributes); builder.MergeAttribute("type", "file"); builder.MergeAttribute("name", name); - return new MvcHtmlString(builder.ToString(TagRenderMode.SelfClosing)); + return new HtmlString(builder.ToString(TagRenderMode.SelfClosing)); } - +*/ #endregion #region OpenGraph - +/* /// /// Gets the opengraph object associated with the current HTTP request. /// /// /// - public static SrkOpenGraphHtmlExtensions OpenGraph(this HtmlHelper html) + public static SrkOpenGraphHtmlExtensions OpenGraph(this IHtmlHelper html) { return new SrkOpenGraphHtmlExtensions(html); } - +*/ #endregion #region ActionLink - +/* /// /// Returns an anchor element (a element) that contains the virtual path of the specified action. /// @@ -988,11 +994,11 @@ public static SrkOpenGraphHtmlExtensions OpenGraph(this HtmlHelper html) /// The protocol for the URL, such as "http" or "https". /// The host name for the URL. /// - public static MvcHtmlString ActionLink(this HtmlHelper htmlHelper, string linkText, string actionName, object routeValues, object htmlAttributes = null, string fragment = null, string controllerName = null, string protocol = null, string hostName = null) + public static HtmlString ActionLink(this IHtmlHelper IHtmlHelper, string linkText, string actionName, object routeValues, object htmlAttributes = null, string fragment = null, string controllerName = null, string protocol = null, string hostName = null) { - return htmlHelper.ActionLink(linkText, actionName, controllerName, protocol, hostName, fragment, routeValues, htmlAttributes); + return IHtmlHelper.ActionLink(linkText, actionName, controllerName, protocol, hostName, fragment, routeValues, htmlAttributes); } - +*/ #endregion /// @@ -1003,7 +1009,7 @@ public static MvcHtmlString ActionLink(this HtmlHelper htmlHelper, string linkTe /// The class to display if the condition is true. /// The class to display if the condition is false. /// The CSS class corresponding to the condition - public static string CssClass(this HtmlHelper html, bool condition, string classTrue, string classFalse = null) + public static string CssClass(this IHtmlHelper html, bool condition, string classTrue, string classFalse = null) { return condition ? classTrue : classFalse; } @@ -1017,7 +1023,7 @@ public static string CssClass(this HtmlHelper html, bool condition, string class /// The class to display if the condition is false. /// The class to display if the condition is null. /// The CSS class corresponding to the condition - public static string CssClass(this HtmlHelper html, bool? condition, string classTrue, string classFalse = null, string classNull = null) + public static string CssClass(this IHtmlHelper html, bool? condition, string classTrue, string classFalse = null, string classNull = null) { if (condition != null) return condition.Value ? classTrue : classFalse; @@ -1030,7 +1036,7 @@ public static string CssClass(this HtmlHelper html, bool? condition, string clas /// The HTML. /// /// html - public static bool HasOtherValidationErrors(this HtmlHelper html) + public static bool HasOtherValidationErrors(this IHtmlHelper html) { if (html == null) throw new ArgumentNullException("html"); @@ -1049,13 +1055,13 @@ public static bool HasOtherValidationErrors(this HtmlHelper html) return html.ViewData.ModelState[string.Empty].Errors.Count > 0; } - +/* /// /// Enhancement of that shows no HTML when there are no errors to display. /// /// The HTML. /// A string that contains an unordered list (ul element) of validation messages. - public static MvcHtmlString ValidationSummaryEx(this HtmlHelper html) + public static HtmlString ValidationSummaryEx(this IHtmlHelper html) { if (SrkHtmlExtensions.HasOtherValidationErrors(html)) { @@ -1064,13 +1070,13 @@ public static MvcHtmlString ValidationSummaryEx(this HtmlHelper html) return null; } - +*/ /// /// Gets the associated to the request. /// /// The HTML. /// - public static SrkToolkit.Web.NavigationLine NavigationLine(this HtmlHelper html) + public static NavigationLine NavigationLine(this IHtmlHelper html) { if (html.ViewContext == null) throw new ArgumentNullException("ViewContext is not set", "ctrl"); @@ -1087,18 +1093,18 @@ public static SrkToolkit.Web.NavigationLine NavigationLine(this HtmlHelper html) return line; } - +/* /// /// Returns an anchor element (a element) that contains a phone call url. /// /// The HTML. /// The phone number. /// - public static MvcHtmlString CallLink(this HtmlHelper html, string phoneNumber) + public static HtmlString CallLink(this IHtmlHelper html, string phoneNumber) { return SrkHtmlExtensions.CallLink(html, phoneNumber, new { @class = "tel", }); } - +*//* /// /// Returns an anchor element (a element) that contains a phone call url. /// @@ -1106,23 +1112,24 @@ public static MvcHtmlString CallLink(this HtmlHelper html, string phoneNumber) /// The phone number. /// An object that contains the HTML attributes for the element. /// - public static MvcHtmlString CallLink(this HtmlHelper html, string phoneNumber, object attributes) + public static HtmlString CallLink(this IHtmlHelper html, string phoneNumber, object attributes) { var tag = new TagBuilder("a"); tag.Attributes.Add("href", "tel:" + phoneNumber); var attrCollection = HtmlHelper.AnonymousObjectToHtmlAttributes(attributes); tag.MergeAttributes(attrCollection, true); - tag.SetInnerText(phoneNumber); + ////tag.SetInnerText(phoneNumber); // AspNet + tag.InnerHtml.Append(phoneNumber); // AspNetCore? return tag.ToMvcHtmlString(TagRenderMode.Normal); } - +*/ /// /// Helps attach descriptors to a page in order to generate meta/link tags. /// /// The HTML. /// The for the current request. /// html or html.ViewContext or html.ViewContext.HttpContext - public static PageInfo GetPageInfo(this HtmlHelper html) + public static PageInfo GetPageInfo(this IHtmlHelper html) { if (html == null) throw new ArgumentNullException("html"); diff --git a/Sources/NET4.SrkToolkit.Web/SrkHttpApplication.cs b/Sources/SrkToolkit.Web.AspNetCore2/SrkHttpApplication.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Web/SrkHttpApplication.cs rename to Sources/SrkToolkit.Web.AspNetCore2/SrkHttpApplication.cs diff --git a/Sources/NET4.SrkToolkit.Web/SrkHttpApplication.tt b/Sources/SrkToolkit.Web.AspNetCore2/SrkHttpApplication.tt similarity index 100% rename from Sources/NET4.SrkToolkit.Web/SrkHttpApplication.tt rename to Sources/SrkToolkit.Web.AspNetCore2/SrkHttpApplication.tt diff --git a/Sources/NET4.SrkToolkit.Web/SrkHttpApplication.tt.cs b/Sources/SrkToolkit.Web.AspNetCore2/SrkHttpApplication.tt.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Web/SrkHttpApplication.tt.cs rename to Sources/SrkToolkit.Web.AspNetCore2/SrkHttpApplication.tt.cs diff --git a/Sources/NET4.SrkToolkit.Web/SrkHttpContextExtensions.cs b/Sources/SrkToolkit.Web.AspNetCore2/SrkHttpContextExtensions.cs similarity index 96% rename from Sources/NET4.SrkToolkit.Web/SrkHttpContextExtensions.cs rename to Sources/SrkToolkit.Web.AspNetCore2/SrkHttpContextExtensions.cs index f38f5b5..074c782 100644 --- a/Sources/NET4.SrkToolkit.Web/SrkHttpContextExtensions.cs +++ b/Sources/SrkToolkit.Web.AspNetCore2/SrkHttpContextExtensions.cs @@ -16,12 +16,12 @@ namespace SrkToolkit.Web { + using Microsoft.AspNetCore.Http; using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; - using System.Web; /// /// Extension methods for the and classes. @@ -41,7 +41,7 @@ public static string GetUserIdentityName(this HttpContext httpContext) return httpContext.User != null && httpContext.User.Identity != null ? httpContext.User.Identity.Name.NullIfEmptyOrWhitespace() : null; } - +/* /// /// Fast access to HttpContext.User.Identity.Name. /// @@ -55,7 +55,7 @@ public static string GetUserIdentityName(this HttpContextBase httpContext) return httpContext.User != null && httpContext.User.Identity != null ? httpContext.User.Identity.Name.NullIfEmptyOrWhitespace() : null; } - +*//* /// /// Sets the timezone for displays of dates and times. /// @@ -72,7 +72,7 @@ public static HttpContextBase SetTimezone(this HttpContextBase http, string time SrkHttpContextExtensions.SetTimezone(http, TimeZoneInfo.FindSystemTimeZoneById(timeZoneName)); return http; } - +*//* /// /// Sets the timezone for displays of dates and times. /// @@ -88,7 +88,7 @@ public static HttpContextBase SetTimezone(this HttpContextBase http, TimeZoneInf http.Items["Timezone"] = timeZone; return http; } - +*/ /// /// Sets the timezone for displays of dates and times. /// @@ -121,7 +121,7 @@ public static HttpContext SetTimezone(this HttpContext http, TimeZoneInfo timeZo http.Items["Timezone"] = timeZone; return http; } - +/* /// /// Gets the timezone for displays of dates and times. /// @@ -135,7 +135,7 @@ public static TimeZoneInfo GetTimezone(this HttpContextBase http) return (TimeZoneInfo)http.Items["Timezone"] ?? TimeZoneInfo.Utc; } - +*/ /// /// Gets the timezone for displays of dates and times. /// @@ -149,7 +149,7 @@ public static TimeZoneInfo GetTimezone(this HttpContext http) return (TimeZoneInfo)http.Items["Timezone"] ?? TimeZoneInfo.Utc; } - +/* /// /// Sets the culture. /// @@ -173,7 +173,7 @@ public static HttpContextBase SetCulture(this HttpContextBase http, string cultu http.Items["Culture"] = cultureInfo; return http; } - +*/ /// /// Sets the culture. /// @@ -197,7 +197,7 @@ public static HttpContext SetCulture(this HttpContext http, string culture) http.Items["Culture"] = cultureInfo; return http; } - +/* /// /// Sets the culture. /// @@ -213,7 +213,7 @@ public static HttpContextBase SetCulture(this HttpContextBase http, CultureInfo http.Items["Culture"] = culture; return http; } - +*/ /// /// Sets the culture. /// @@ -229,7 +229,7 @@ public static HttpContext SetCulture(this HttpContext http, CultureInfo culture) http.Items["Culture"] = culture; return http; } - +/* /// /// Gets the current culture. /// @@ -243,7 +243,7 @@ public static CultureInfo GetCulture(this HttpContextBase http) return (CultureInfo)http.Items["Culture"] ?? CultureInfo.CurrentCulture; } - +*/ /// /// Gets the current culture. /// @@ -257,7 +257,7 @@ public static CultureInfo GetCulture(this HttpContext http) return (CultureInfo)http.Items["Culture"] ?? CultureInfo.CurrentCulture; } - +/* /// /// Sets the UICulture. /// @@ -281,7 +281,7 @@ public static HttpContextBase SetUICulture(this HttpContextBase http, string uIC http.Items["UICulture"] = cultureInfo; return http; } - +*/ /// /// Sets the UICulture. /// @@ -305,7 +305,7 @@ public static HttpContext SetUICulture(this HttpContext http, string uICulture) http.Items["UICulture"] = cultureInfo; return http; } - +/* /// /// Sets the UICulture. /// @@ -321,7 +321,7 @@ public static HttpContextBase SetUICulture(this HttpContextBase http, CultureInf http.Items["UICulture"] = uICulture; return http; } - +*/ /// /// Sets the UICulture. /// @@ -337,7 +337,7 @@ public static HttpContext SetUICulture(this HttpContext http, CultureInfo uICult http.Items["UICulture"] = uICulture; return http; } - +/* /// /// Gets the current UICulture. /// @@ -351,7 +351,7 @@ public static CultureInfo GetUICulture(this HttpContextBase http) return (CultureInfo)http.Items["UICulture"] ?? CultureInfo.CurrentUICulture; } - +*/ /// /// Gets the current UICulture. /// @@ -365,7 +365,7 @@ public static CultureInfo GetUICulture(this HttpContext http) return (CultureInfo)http.Items["UICulture"] ?? CultureInfo.CurrentUICulture; } - +/* /// /// Sets the date and time formats. /// @@ -438,7 +438,7 @@ public static void SetDateTimeFormats(this HttpContextBase httpContext, string d httpContext.Items[System.Web.Mvc.SrkHtmlExtensions.defaultDateTimeFormatsKey] = values; } - +*//* /// /// Gets the date and time formats. /// @@ -455,5 +455,6 @@ public static string[] GetDateTimeFormats(this HttpContextBase httpContext) return values; } +*/ } } diff --git a/Sources/SrkToolkit.Web.AspNetCore2/SrkHttpRequestExtensions.cs b/Sources/SrkToolkit.Web.AspNetCore2/SrkHttpRequestExtensions.cs new file mode 100644 index 0000000..ab17355 --- /dev/null +++ b/Sources/SrkToolkit.Web.AspNetCore2/SrkHttpRequestExtensions.cs @@ -0,0 +1,48 @@ + +namespace SrkToolkit.AspNetCore +{ + using Microsoft.AspNetCore.Http; + using System; + using System.Diagnostics; + using System.Linq; + using System.Net.Http; + + public static class SrkHttpRequestExtensions + { + public static bool PrefersJson(this HttpRequestMessage request) + { + if (request.Headers.Accept.Any()) + { + foreach (var header in request.Headers.Accept) + { + if ("application/json".Equals(header.MediaType, StringComparison.OrdinalIgnoreCase)) + { + return true; + } + } + } + + return false; + } + + // TODO: support HttpRequest.PrefersJson, but which nuget? +#if !NETSTANDARD + public static bool PrefersJson(this HttpRequest request) + { + Debug.Assert(request != null, nameof(request) + " != null"); + if (request.Headers.Accept.Any()) + { + foreach (var header in request.Headers.Accept) + { + if ("application/json".Equals(header, StringComparison.OrdinalIgnoreCase)) + { + return true; + } + } + } + + return false; + } +#endif + } +} diff --git a/Sources/NET4.SrkToolkit.Web/SrkTempDataDictionaryExtensions.cs b/Sources/SrkToolkit.Web.AspNetCore2/SrkTempDataDictionaryExtensions.cs similarity index 96% rename from Sources/NET4.SrkToolkit.Web/SrkTempDataDictionaryExtensions.cs rename to Sources/SrkToolkit.Web.AspNetCore2/SrkTempDataDictionaryExtensions.cs index 4cfdfd7..80aba8f 100644 --- a/Sources/NET4.SrkToolkit.Web/SrkTempDataDictionaryExtensions.cs +++ b/Sources/SrkToolkit.Web.AspNetCore2/SrkTempDataDictionaryExtensions.cs @@ -16,9 +16,9 @@ namespace SrkToolkit.Web { - using System.Collections.Generic; - using System.Web.Mvc; + using Microsoft.AspNetCore.Mvc.ViewFeatures; using SrkToolkit.Web.Models; + using System.Collections.Generic; /// /// Extensions methods for . diff --git a/Sources/SrkToolkit.Web.AspNetCore2/SrkToolkit.Web.AspNetCore2.csproj b/Sources/SrkToolkit.Web.AspNetCore2/SrkToolkit.Web.AspNetCore2.csproj new file mode 100644 index 0000000..f4d3d31 --- /dev/null +++ b/Sources/SrkToolkit.Web.AspNetCore2/SrkToolkit.Web.AspNetCore2.csproj @@ -0,0 +1,131 @@ + + + + netstandard2.0 + enable + default + SrkToolkit.Web.AspNetCore2 + true + 2.0.0-preview1 + SandRock + SrkToolkit.Web.AspNetCore2 is a bunch of extensions and tools to use with your ASP MVC Core project. + https://github.com/sandrock/SrkToolkit/ + https://github.com/sandrock/SrkToolkit/blob/master/LICENSE + SrkToolkit AspMvc AspMvcCore MVC Html NavigationLine TempData TempMessage WebDependencies AuthorizeAttribute OpenGraph DisplayDate DisplayTime + 2.0.0.0 + 2.0.0.0 + true + ..\SrkToolkit.snk + + + + TRACE;ASPMVCCORE + + + + TRACE;ASPMVCCORE + + + + + SrkToolkit.snk + + + + + + + + + + + + + + + + + + + + Open\NavigationLine.cs + + + Open\NavigationLineEntry.cs + + + Open\OpenGraphName.cs + + + Open\OpenGraphNamespace.cs + + + Open\OpenGraphObject.cs + + + Open\OpenGraphTag.cs + + + Open\PageInfo.cs + + + Open\PageInfoItem.cs + + + Open\PageInfoObject.cs + + + Open\SrkOpenGraphHtmlExtensions.cs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Sources/NET4.SrkToolkit.Web/System.Web.Mvc/SrkMvcCollectionExtensions.cs b/Sources/SrkToolkit.Web.AspNetCore2/System.Web.Mvc/SrkMvcCollectionExtensions.cs similarity index 95% rename from Sources/NET4.SrkToolkit.Web/System.Web.Mvc/SrkMvcCollectionExtensions.cs rename to Sources/SrkToolkit.Web.AspNetCore2/System.Web.Mvc/SrkMvcCollectionExtensions.cs index 7861b6d..11b7906 100644 --- a/Sources/NET4.SrkToolkit.Web/System.Web.Mvc/SrkMvcCollectionExtensions.cs +++ b/Sources/SrkToolkit.Web.AspNetCore2/System.Web.Mvc/SrkMvcCollectionExtensions.cs @@ -16,11 +16,11 @@ namespace System.Web.Mvc { + using Microsoft.AspNetCore.Mvc.Rendering; using System; using System.Collections.Generic; using System.Linq; using System.Text; - using System.Web.Mvc; /// /// Extension methods for the interface within MVC views. diff --git a/Sources/NET4.SrkToolkit.Web/System.Web.Mvc/SrkTagBuilderExtensions.cs b/Sources/SrkToolkit.Web.AspNetCore2/System.Web.Mvc/SrkTagBuilderExtensions.cs similarity index 79% rename from Sources/NET4.SrkToolkit.Web/System.Web.Mvc/SrkTagBuilderExtensions.cs rename to Sources/SrkToolkit.Web.AspNetCore2/System.Web.Mvc/SrkTagBuilderExtensions.cs index f06c98a..a00e108 100644 --- a/Sources/NET4.SrkToolkit.Web/System.Web.Mvc/SrkTagBuilderExtensions.cs +++ b/Sources/SrkToolkit.Web.AspNetCore2/System.Web.Mvc/SrkTagBuilderExtensions.cs @@ -16,11 +16,12 @@ namespace System.Web.Mvc { + using Microsoft.AspNetCore.Html; + using Microsoft.AspNetCore.Mvc.Rendering; using System; using System.Collections.Generic; using System.Linq; using System.Text; - using System.Web.Mvc; /// /// Extension methods for the class. @@ -34,9 +35,9 @@ public static class SrkTagBuilderExtensions /// The tag builder. /// The render mode. /// - public static MvcHtmlString ToMvcHtmlString(this TagBuilder tagBuilder, TagRenderMode renderMode) + public static HtmlString ToMvcHtmlString(this TagBuilder tagBuilder, TagRenderMode renderMode) { - return new MvcHtmlString(tagBuilder.ToString(renderMode)); + return new HtmlString(tagBuilder.ToString(renderMode)); } #endif } diff --git a/Sources/NET4.SrkToolkit.Web/System.Web.Mvc/SrkUrlHelperExtensions.cs b/Sources/SrkToolkit.Web.AspNetCore2/System.Web.Mvc/SrkUrlHelperExtensions.cs similarity index 97% rename from Sources/NET4.SrkToolkit.Web/System.Web.Mvc/SrkUrlHelperExtensions.cs rename to Sources/SrkToolkit.Web.AspNetCore2/System.Web.Mvc/SrkUrlHelperExtensions.cs index 7144f7a..91b49f2 100644 --- a/Sources/NET4.SrkToolkit.Web/System.Web.Mvc/SrkUrlHelperExtensions.cs +++ b/Sources/SrkToolkit.Web.AspNetCore2/System.Web.Mvc/SrkUrlHelperExtensions.cs @@ -16,6 +16,7 @@ namespace System.Web.Mvc { + using Microsoft.AspNetCore.Mvc.Routing; using System; using System.Collections.Generic; using System.Linq; diff --git a/Sources/NET4.SrkToolkit.Web/System.Web.Mvc/SrkViewExtensions.cs b/Sources/SrkToolkit.Web.AspNetCore2/System.Web.Mvc/SrkViewExtensions.cs similarity index 96% rename from Sources/NET4.SrkToolkit.Web/System.Web.Mvc/SrkViewExtensions.cs rename to Sources/SrkToolkit.Web.AspNetCore2/System.Web.Mvc/SrkViewExtensions.cs index ad1cc89..1b22713 100644 --- a/Sources/NET4.SrkToolkit.Web/System.Web.Mvc/SrkViewExtensions.cs +++ b/Sources/SrkToolkit.Web.AspNetCore2/System.Web.Mvc/SrkViewExtensions.cs @@ -16,11 +16,11 @@ namespace System.Web.Mvc { + using SrkToolkit.Web.Models; using System; using System.Collections.Generic; using System.Linq; using System.Text; - using SrkToolkit.Web.Models; /// /// Extension methods for . diff --git a/Sources/NET4.SrkToolkit.Web/WebDependencies.cs b/Sources/SrkToolkit.Web.AspNetCore2/WebDependencies.cs similarity index 93% rename from Sources/NET4.SrkToolkit.Web/WebDependencies.cs rename to Sources/SrkToolkit.Web.AspNetCore2/WebDependencies.cs index 5f6e136..73455a5 100644 --- a/Sources/NET4.SrkToolkit.Web/WebDependencies.cs +++ b/Sources/SrkToolkit.Web.AspNetCore2/WebDependencies.cs @@ -16,13 +16,12 @@ namespace SrkToolkit.Web { + using Microsoft.AspNetCore.Html; + using Microsoft.AspNetCore.Mvc.Rendering; using System; using System.Collections.Generic; using System.Linq; using System.Text; - using System.Web; - using System.Web.Hosting; - using System.Web.Mvc; /// /// Manages web dependencies such as scripts and styles. @@ -44,7 +43,7 @@ public WebDependencies() /// The value. /// HTML /// value - public MvcHtmlString Render(WebDependency value) + public HtmlString Render(WebDependency value) { if (value == null) throw new ArgumentNullException("value"); @@ -57,10 +56,10 @@ public MvcHtmlString Render(WebDependency value) RenderDependency(value.Files[i], sb); } - return MvcHtmlString.Create(sb.ToString()); + return new HtmlString(sb.ToString()); } - return MvcHtmlString.Empty; + return HtmlString.Empty; } /// @@ -122,7 +121,7 @@ public WebDependencies Include(WebDependency value, WebDependencyPosition positi /// /// The position. /// - public MvcHtmlString RenderIncludes(WebDependencyPosition position) + public HtmlString RenderIncludes(WebDependencyPosition position) { var sb = new StringBuilder(); sb.AppendLine(""); @@ -150,7 +149,7 @@ public MvcHtmlString RenderIncludes(WebDependencyPosition position) } sb.AppendLine(""); - return MvcHtmlString.Create(sb.ToString()); + return new HtmlString(sb.ToString()); } protected static void RenderDependency(WebDependencyFile value, StringBuilder sb) diff --git a/Sources/NET4.SrkToolkit.Web/WebDependenciesExtensions.cs b/Sources/SrkToolkit.Web.AspNetCore2/WebDependenciesExtensions.cs similarity index 96% rename from Sources/NET4.SrkToolkit.Web/WebDependenciesExtensions.cs rename to Sources/SrkToolkit.Web.AspNetCore2/WebDependenciesExtensions.cs index 3cdea85..dc7b30d 100644 --- a/Sources/NET4.SrkToolkit.Web/WebDependenciesExtensions.cs +++ b/Sources/SrkToolkit.Web.AspNetCore2/WebDependenciesExtensions.cs @@ -20,7 +20,6 @@ namespace SrkToolkit.Web using System.Collections.Generic; using System.Linq; using System.Text; - using System.Web.Mvc; /// /// Extension methods for the class. diff --git a/Sources/NET4.SrkToolkit.Web/WebDependency.cs b/Sources/SrkToolkit.Web.AspNetCore2/WebDependency.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Web/WebDependency.cs rename to Sources/SrkToolkit.Web.AspNetCore2/WebDependency.cs diff --git a/Sources/NET4.SrkToolkit.Web/WebDependencyFile.cs b/Sources/SrkToolkit.Web.AspNetCore2/WebDependencyFile.cs similarity index 100% rename from Sources/NET4.SrkToolkit.Web/WebDependencyFile.cs rename to Sources/SrkToolkit.Web.AspNetCore2/WebDependencyFile.cs From f18fac878cba00e3b0712a49eda383c338ca427a Mon Sep 17 00:00:00 2001 From: SandRock Date: Fri, 10 Mar 2023 10:36:23 +0100 Subject: [PATCH 02/34] removal of SrkToolkit.Xaml and SrkToolkit.Mvvm --- .../BusyTaskCollectionTests.cs | 156 ----- .../InteractionViewModelBaseTests.cs | 30 - .../NET4.SrkToolkit.Mvvm.Tests.csproj | 79 --- .../Properties/AssemblyInfo.cs | 10 - .../RelayCommandTests.cs | 211 ------ .../ViewModelBaseTests.cs | 110 --- .../Properties/AssemblyInfo.cs | 10 - .../SL4.SrkToolkit.Mvvm.csproj | 129 ---- .../Behaviors/InputEnterBehavior.cs | 352 ---------- .../Behaviors/ListBoxScrollBehavior.cs | 307 --------- .../Extensions/DependencyObjectExtensions.cs | 76 --- .../Internal/DisposableEventHandler.cs | 43 -- .../Properties/AssemblyInfo.cs | 9 - .../SL4.SrkToolkit.Xaml.csproj | 104 --- .../Properties/AssemblyInfo.cs | 19 - .../SL5.SrkToolkit.Xaml.csproj | 102 --- Sources/SrkToolkit.Xaml.AssemblyInfo.cs | 21 - .../NavigationService.UWP.cs | 55 -- Sources/UWP461.SrkToolkit.Mvvm/Page.UWP.cs | 99 --- .../Properties/AssemblyInfo.cs | 13 - .../Services/PagesServiceBase.cs | 94 --- .../UWP461.SrkToolkit.Mvvm.csproj | 96 --- .../UWP461.SrkToolkit.Mvvm/ViewModelBase.cs | 33 - .../Properties/AssemblyInfo.cs | 9 - .../UWP461.SrkToolkit.Xaml.csproj | 70 -- .../Commands/RelayCommand.T.cs | 99 --- .../Commands/RelayCommand.cs | 99 --- .../WP7.SrkToolkit.Mvvm/GlobalSuppressions.cs | 26 - .../InteractionViewModelBase.WP7.cs | 311 --------- .../PhoneAppNavigationState.cs | 59 -- .../WP7.SrkToolkit.Mvvm/PhoneAppService.cs | 112 --- .../PhoneApplicationPage.cs | 149 ---- .../Properties/AssemblyInfo.cs | 10 - .../System/DataEventArgs.cs | 32 - Sources/WP7.SrkToolkit.Mvvm/ViewModelBase.cs | 42 -- .../VisualStateChangeEventArgs.cs | 49 -- .../WP7.SrkToolkit.Mvvm.csproj | 96 --- .../WP7.SrkToolkit.Xaml/Controls/Button.cs | 71 -- .../Controls/HyperlinkButton.cs | 56 -- Sources/WP7.SrkToolkit.Xaml/Internal/Trace.cs | 312 --------- .../Properties/AssemblyInfo.cs | 14 - .../WP7.SrkToolkit.Xaml.csproj | 89 --- .../Properties/AssemblyInfo.cs | 10 - .../WP71.SrkToolkit.Mvvm.csproj | 110 --- .../Properties/AssemblyInfo.cs | 13 - .../WP71.SrkToolkit.Xaml.csproj | 98 --- .../Properties/AssemblyInfo.cs | 12 - .../WP80.SrkToolkit.Mvvm.csproj | 137 ---- .../Controls/DataTemplateSelector.cs | 27 - .../Properties/AssemblyInfo.cs | 9 - .../Commands/RelayCommand.T.cs | 129 ---- .../Commands/RelayCommand.cs | 129 ---- .../DispatcherExtensions.cs | 60 -- .../GlobalSuppressions.cs | 32 - .../InteractionViewModelBase.cs | 204 ------ .../Properties/AssemblyInfo.cs | 12 - .../System/DataEventArgs.cs | 51 -- .../WPF4.SrkToolkit.Mvvm/Tools/BusyTask.cs | 183 ----- .../Tools/BusyTaskCollection.cs | 273 -------- .../Tools/BusyTaskType.cs | 44 -- .../Tools/IMessageBoxService.cs | 50 -- .../Tools/MessageBoxService.cs | 112 --- .../ViewModelBase.Common.cs | 249 ------- Sources/WPF4.SrkToolkit.Mvvm/ViewModelBase.cs | 83 --- .../WPF4.SrkToolkit.Mvvm.csproj | 82 --- .../Behaviors/WindowControls.cs | 646 ------------------ .../Converters/BoolToVisibilityConverter.cs | 133 ---- .../Converters/DateTimeDateConverter.cs | 80 --- .../NotNullToVisibilityConverter.cs | 114 ---- .../Converters/OppositeBoolConverter.cs | 72 -- .../Converters/ToLowerConverter.cs | 40 -- .../Converters/ToUpperConverter.cs | 40 -- .../Extensions/DispatcherExtensions.cs | 92 --- .../GlobalSuppressions.cs | 17 - .../Properties/AssemblyInfo.cs | 9 - Sources/WPF4.SrkToolkit.Xaml/RelayCommand.cs | 105 --- .../WPF4.SrkToolkit.Xaml.csproj | 104 --- .../Properties/AssemblyInfo.cs | 24 - .../Properties/Resources.Designer.cs | 63 -- .../Properties/Resources.resx | 117 ---- .../Properties/Settings.Designer.cs | 26 - .../Properties/Settings.settings | 7 - .../WPF45.SrkToolkit.Mvvm.csproj | 119 ---- .../Properties/AssemblyInfo.cs | 9 - .../WPF45.SrkToolkit.Xaml.csproj | 103 --- 85 files changed, 7892 deletions(-) delete mode 100644 Sources/NET4.SrkToolkit.Mvvm.Tests/BusyTaskCollectionTests.cs delete mode 100644 Sources/NET4.SrkToolkit.Mvvm.Tests/InteractionViewModelBaseTests.cs delete mode 100644 Sources/NET4.SrkToolkit.Mvvm.Tests/NET4.SrkToolkit.Mvvm.Tests.csproj delete mode 100644 Sources/NET4.SrkToolkit.Mvvm.Tests/Properties/AssemblyInfo.cs delete mode 100644 Sources/NET4.SrkToolkit.Mvvm.Tests/RelayCommandTests.cs delete mode 100644 Sources/NET4.SrkToolkit.Mvvm.Tests/ViewModelBaseTests.cs delete mode 100644 Sources/SL4.SrkToolkit.Mvvm/Properties/AssemblyInfo.cs delete mode 100644 Sources/SL4.SrkToolkit.Mvvm/SL4.SrkToolkit.Mvvm.csproj delete mode 100644 Sources/SL4.SrkToolkit.Xaml/Behaviors/InputEnterBehavior.cs delete mode 100644 Sources/SL4.SrkToolkit.Xaml/Behaviors/ListBoxScrollBehavior.cs delete mode 100644 Sources/SL4.SrkToolkit.Xaml/Extensions/DependencyObjectExtensions.cs delete mode 100644 Sources/SL4.SrkToolkit.Xaml/Internal/DisposableEventHandler.cs delete mode 100644 Sources/SL4.SrkToolkit.Xaml/Properties/AssemblyInfo.cs delete mode 100644 Sources/SL4.SrkToolkit.Xaml/SL4.SrkToolkit.Xaml.csproj delete mode 100644 Sources/SL5.SrkToolkit.Xaml/Properties/AssemblyInfo.cs delete mode 100644 Sources/SL5.SrkToolkit.Xaml/SL5.SrkToolkit.Xaml.csproj delete mode 100644 Sources/SrkToolkit.Xaml.AssemblyInfo.cs delete mode 100644 Sources/UWP461.SrkToolkit.Mvvm/NavigationService.UWP.cs delete mode 100644 Sources/UWP461.SrkToolkit.Mvvm/Page.UWP.cs delete mode 100644 Sources/UWP461.SrkToolkit.Mvvm/Properties/AssemblyInfo.cs delete mode 100644 Sources/UWP461.SrkToolkit.Mvvm/Services/PagesServiceBase.cs delete mode 100644 Sources/UWP461.SrkToolkit.Mvvm/UWP461.SrkToolkit.Mvvm.csproj delete mode 100644 Sources/UWP461.SrkToolkit.Mvvm/ViewModelBase.cs delete mode 100644 Sources/UWP461.SrkToolkit.Xaml/Properties/AssemblyInfo.cs delete mode 100644 Sources/UWP461.SrkToolkit.Xaml/UWP461.SrkToolkit.Xaml.csproj delete mode 100644 Sources/WP7.SrkToolkit.Mvvm/Commands/RelayCommand.T.cs delete mode 100644 Sources/WP7.SrkToolkit.Mvvm/Commands/RelayCommand.cs delete mode 100644 Sources/WP7.SrkToolkit.Mvvm/GlobalSuppressions.cs delete mode 100644 Sources/WP7.SrkToolkit.Mvvm/InteractionViewModelBase.WP7.cs delete mode 100644 Sources/WP7.SrkToolkit.Mvvm/PhoneAppNavigationState.cs delete mode 100644 Sources/WP7.SrkToolkit.Mvvm/PhoneAppService.cs delete mode 100644 Sources/WP7.SrkToolkit.Mvvm/PhoneApplicationPage.cs delete mode 100644 Sources/WP7.SrkToolkit.Mvvm/Properties/AssemblyInfo.cs delete mode 100644 Sources/WP7.SrkToolkit.Mvvm/System/DataEventArgs.cs delete mode 100644 Sources/WP7.SrkToolkit.Mvvm/ViewModelBase.cs delete mode 100644 Sources/WP7.SrkToolkit.Mvvm/VisualStateChangeEventArgs.cs delete mode 100644 Sources/WP7.SrkToolkit.Mvvm/WP7.SrkToolkit.Mvvm.csproj delete mode 100644 Sources/WP7.SrkToolkit.Xaml/Controls/Button.cs delete mode 100644 Sources/WP7.SrkToolkit.Xaml/Controls/HyperlinkButton.cs delete mode 100644 Sources/WP7.SrkToolkit.Xaml/Internal/Trace.cs delete mode 100644 Sources/WP7.SrkToolkit.Xaml/Properties/AssemblyInfo.cs delete mode 100644 Sources/WP7.SrkToolkit.Xaml/WP7.SrkToolkit.Xaml.csproj delete mode 100644 Sources/WP71.SrkToolkit.Mvvm/Properties/AssemblyInfo.cs delete mode 100644 Sources/WP71.SrkToolkit.Mvvm/WP71.SrkToolkit.Mvvm.csproj delete mode 100644 Sources/WP71.SrkToolkit.Xaml/Properties/AssemblyInfo.cs delete mode 100644 Sources/WP71.SrkToolkit.Xaml/WP71.SrkToolkit.Xaml.csproj delete mode 100644 Sources/WP80.SrkToolkit.Mvvm/Properties/AssemblyInfo.cs delete mode 100644 Sources/WP80.SrkToolkit.Mvvm/WP80.SrkToolkit.Mvvm.csproj delete mode 100644 Sources/WP80.SrkToolkit.Xaml/Controls/DataTemplateSelector.cs delete mode 100644 Sources/WP80.SrkToolkit.Xaml/Properties/AssemblyInfo.cs delete mode 100644 Sources/WPF4.SrkToolkit.Mvvm/Commands/RelayCommand.T.cs delete mode 100644 Sources/WPF4.SrkToolkit.Mvvm/Commands/RelayCommand.cs delete mode 100644 Sources/WPF4.SrkToolkit.Mvvm/DispatcherExtensions.cs delete mode 100644 Sources/WPF4.SrkToolkit.Mvvm/GlobalSuppressions.cs delete mode 100644 Sources/WPF4.SrkToolkit.Mvvm/InteractionViewModelBase.cs delete mode 100644 Sources/WPF4.SrkToolkit.Mvvm/Properties/AssemblyInfo.cs delete mode 100644 Sources/WPF4.SrkToolkit.Mvvm/System/DataEventArgs.cs delete mode 100644 Sources/WPF4.SrkToolkit.Mvvm/Tools/BusyTask.cs delete mode 100644 Sources/WPF4.SrkToolkit.Mvvm/Tools/BusyTaskCollection.cs delete mode 100644 Sources/WPF4.SrkToolkit.Mvvm/Tools/BusyTaskType.cs delete mode 100644 Sources/WPF4.SrkToolkit.Mvvm/Tools/IMessageBoxService.cs delete mode 100644 Sources/WPF4.SrkToolkit.Mvvm/Tools/MessageBoxService.cs delete mode 100644 Sources/WPF4.SrkToolkit.Mvvm/ViewModelBase.Common.cs delete mode 100644 Sources/WPF4.SrkToolkit.Mvvm/ViewModelBase.cs delete mode 100644 Sources/WPF4.SrkToolkit.Mvvm/WPF4.SrkToolkit.Mvvm.csproj delete mode 100644 Sources/WPF4.SrkToolkit.Xaml/Behaviors/WindowControls.cs delete mode 100644 Sources/WPF4.SrkToolkit.Xaml/Converters/BoolToVisibilityConverter.cs delete mode 100644 Sources/WPF4.SrkToolkit.Xaml/Converters/DateTimeDateConverter.cs delete mode 100644 Sources/WPF4.SrkToolkit.Xaml/Converters/NotNullToVisibilityConverter.cs delete mode 100644 Sources/WPF4.SrkToolkit.Xaml/Converters/OppositeBoolConverter.cs delete mode 100644 Sources/WPF4.SrkToolkit.Xaml/Converters/ToLowerConverter.cs delete mode 100644 Sources/WPF4.SrkToolkit.Xaml/Converters/ToUpperConverter.cs delete mode 100644 Sources/WPF4.SrkToolkit.Xaml/Extensions/DispatcherExtensions.cs delete mode 100644 Sources/WPF4.SrkToolkit.Xaml/GlobalSuppressions.cs delete mode 100644 Sources/WPF4.SrkToolkit.Xaml/Properties/AssemblyInfo.cs delete mode 100644 Sources/WPF4.SrkToolkit.Xaml/RelayCommand.cs delete mode 100644 Sources/WPF4.SrkToolkit.Xaml/WPF4.SrkToolkit.Xaml.csproj delete mode 100644 Sources/WPF45.SrkToolkit.Mvvm/Properties/AssemblyInfo.cs delete mode 100644 Sources/WPF45.SrkToolkit.Mvvm/Properties/Resources.Designer.cs delete mode 100644 Sources/WPF45.SrkToolkit.Mvvm/Properties/Resources.resx delete mode 100644 Sources/WPF45.SrkToolkit.Mvvm/Properties/Settings.Designer.cs delete mode 100644 Sources/WPF45.SrkToolkit.Mvvm/Properties/Settings.settings delete mode 100644 Sources/WPF45.SrkToolkit.Mvvm/WPF45.SrkToolkit.Mvvm.csproj delete mode 100644 Sources/WPF45.SrkToolkit.Xaml/Properties/AssemblyInfo.cs delete mode 100644 Sources/WPF45.SrkToolkit.Xaml/WPF45.SrkToolkit.Xaml.csproj diff --git a/Sources/NET4.SrkToolkit.Mvvm.Tests/BusyTaskCollectionTests.cs b/Sources/NET4.SrkToolkit.Mvvm.Tests/BusyTaskCollectionTests.cs deleted file mode 100644 index 92d0b55..0000000 --- a/Sources/NET4.SrkToolkit.Mvvm.Tests/BusyTaskCollectionTests.cs +++ /dev/null @@ -1,156 +0,0 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace SrkToolkit.Mvvm.Tests -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Text; - using Microsoft.VisualStudio.TestTools.UnitTesting; - using SrkToolkit.Mvvm.Tools; - - [TestClass] - public class BusyTaskCollectionTests - { - [TestClass] - public class AddTaskMethod - { - [TestMethod, TestCategory(Category.Unit)] - public void AddWithValuesWorks() - { - // prepare - string key = ";;"; - bool isGlobal = true; - var target = new BusyTaskCollection(); - - // execute - target.Add(key, isGlobal); - - // varify - Assert.AreEqual(1, target.Count); - Assert.AreEqual(key, target[0].Key); - Assert.AreEqual(isGlobal, target[0].IsGlobal); - } - - [TestMethod, TestCategory(Category.Unit)] - public void AddWithTaskWorks() - { - // prepare - var task = new BusyTask(); - var target = new BusyTaskCollection(); - - // execute - target.Add(task); - - // varify - Assert.AreEqual(task, target[0]); - } - } - - [TestClass] - public class Indexer - { - [TestMethod, TestCategory(Category.Unit)] - public void IndexerWorks() - { - // prepare - string key = "aaaa"; - var task = new BusyTask(key); - var target = new BusyTaskCollection(); - target.Add(task); - BusyTask result = null; - - // execute - result = target[key]; - - // verify - Assert.AreSame(task, result); - } - - [TestMethod, TestCategory(Category.Unit)] - public void IndexerFailsWithWrongKey() - { - // prepare - string key = "aaaa"; - var target = new BusyTaskCollection(); - BusyTask result = null; - - // execute - result = target[key]; - - // verify - Assert.IsNull(result); - } - - [TestMethod, TestCategory(Category.Unit)] - public void IndexerFailsWithNullKey() - { - // prepare - string key = null; - var target = new BusyTaskCollection(); - BusyTask result = null; - - // execute - result = target[key]; - - // verify - Assert.IsNull(result); - } - } - - [TestClass] - public class UpdateMethod - { - [TestMethod, TestCategory(Category.Unit)] - public void UpdateWorks() - { - // prepare - string key = "aaaa"; - string message = "Hello world"; - var task = new BusyTask(key); - var target = new BusyTaskCollection(); - target.Add(task); - - // execute - target.Update(key, message, true, BusyTaskType.Error); - - // verify - Assert.AreEqual(message, task.Message); - Assert.IsTrue(task.IsProcessing); - Assert.AreEqual(BusyTaskType.Error, task.Type); - } - } - - [TestClass] - public class AggregateMessageProperty - { - [TestMethod, TestCategory(Category.Unit)] - public void DefaultsToNullWhenZeroTasks() - { - // prepare - var target = new BusyTaskCollection(); - string result = null; - - // execute - result = target.AggregateMessage; - - // verify - Assert.IsNull(result); - } - } - } -} diff --git a/Sources/NET4.SrkToolkit.Mvvm.Tests/InteractionViewModelBaseTests.cs b/Sources/NET4.SrkToolkit.Mvvm.Tests/InteractionViewModelBaseTests.cs deleted file mode 100644 index e56d604..0000000 --- a/Sources/NET4.SrkToolkit.Mvvm.Tests/InteractionViewModelBaseTests.cs +++ /dev/null @@ -1,30 +0,0 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace SrkToolkit.Mvvm.Tests -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Text; - using Microsoft.VisualStudio.TestTools.UnitTesting; - using SrkToolkit.Mvvm; - - [TestClass] - public class InteractionViewModelBaseTests - { - } -} diff --git a/Sources/NET4.SrkToolkit.Mvvm.Tests/NET4.SrkToolkit.Mvvm.Tests.csproj b/Sources/NET4.SrkToolkit.Mvvm.Tests/NET4.SrkToolkit.Mvvm.Tests.csproj deleted file mode 100644 index f9aa6f0..0000000 --- a/Sources/NET4.SrkToolkit.Mvvm.Tests/NET4.SrkToolkit.Mvvm.Tests.csproj +++ /dev/null @@ -1,79 +0,0 @@ - - - - Debug - AnyCPU - - - 2.0 - {9C42B357-7E5D-4192-850D-190EAEC0416A} - Library - Properties - SrkToolkit.Mvvm.Tests - SrkToolkit.Mvvm.Tests - v4.0 - 512 - {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - true - - - SrkToolkit.snk - - - - - - - - 3.5 - - - - - - False - - - - - Category.cs - - - SrkToolkit.Mvvm.AssemblyInfo.cs - - - - - - - - - - - - - {a842e52e-4001-4bd8-bdcd-c95630d984d4} - WPF4.SrkToolkit.Mvvm - - - - \ No newline at end of file diff --git a/Sources/NET4.SrkToolkit.Mvvm.Tests/Properties/AssemblyInfo.cs b/Sources/NET4.SrkToolkit.Mvvm.Tests/Properties/AssemblyInfo.cs deleted file mode 100644 index 3d423dd..0000000 --- a/Sources/NET4.SrkToolkit.Mvvm.Tests/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System; - -[assembly: AssemblyTitle("NET4.SrkToolkit.Mvvm.Tests")] -[assembly: AssemblyDescription("")] - -[assembly: CLSCompliant(false)] -[assembly: Guid("1ec88377-dd13-4acb-9d04-8d84d00ce2b7")] diff --git a/Sources/NET4.SrkToolkit.Mvvm.Tests/RelayCommandTests.cs b/Sources/NET4.SrkToolkit.Mvvm.Tests/RelayCommandTests.cs deleted file mode 100644 index f9561f0..0000000 --- a/Sources/NET4.SrkToolkit.Mvvm.Tests/RelayCommandTests.cs +++ /dev/null @@ -1,211 +0,0 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace SrkToolkit.Mvvm.Tests -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Text; - using Microsoft.VisualStudio.TestTools.UnitTesting; - using SrkToolkit.Mvvm.Commands; - - [TestClass] - public class RelayCommandTests - { - [TestMethod] - public void ExecuteWorks() - { - // prepare - bool executed = false; - var execute = new Action(() => executed = true); - - // execute - var target = new RelayCommand(execute); - target.Execute(null); - - // verify - Assert.IsTrue(executed, "Command did not execute"); - } - - [TestMethod] - public void ExecuteGenericWorks() - { - // prepare - bool executed = false; - int param = 42, paramReceived = int.MinValue; - var execute = new Action((i) => - { - executed = true; - paramReceived = i; - }); - - // execute - var target = new RelayCommand(execute); - target.Execute(param); - - // verify - Assert.IsTrue(executed, "Command did not execute"); - Assert.AreEqual(param, paramReceived, "Command did not pass parameter"); - } - - [TestMethod] - public void CanExecuteWorks() - { - // prepare - bool executed = false; - var execute = new Action(() => { }); - var can = new Func(() => - { - executed = true; - return false; - }); - bool result; - - // execute - var target = new RelayCommand(execute, can, false); - result = target.CanExecute(null); - - // verify - Assert.IsTrue(executed, "Command did not test canexecute"); - Assert.IsFalse(result, "Command did not pass parameter"); - } - - [TestMethod] - public void CanExecuteGenericWorks() - { - // prepare - bool executed = false; - int param = 42, paramReceived = int.MinValue; - var execute = new Action((i) => { }); - var can = new Predicate((i) => - { - executed = true; - paramReceived = i; - return false; - }); - bool result; - - // execute - var target = new RelayCommand(execute, can, false); - result = target.CanExecute(param); - - // verify - Assert.IsTrue(executed, "Command did not test canexecute"); - Assert.IsFalse(result, "Command did not pass parameter"); - } - - [TestMethod] - public void CanExecutePreventsExecuteWorks() - { - // prepare - bool executed = false; - bool execed = false; - var execute = new Action(() => - { - execed = true; - }); - var can = new Func(() => - { - executed = true; - return false; - }); - - // execute - var target = new RelayCommand(execute, can, true); - target.Execute(null); - - // verify - Assert.IsFalse(execed, "Command executed execute"); - } - - [TestMethod] - public void CanExecutePreventsExecuteGenericWorks() - { - // prepare - bool executed = false; - bool execed = false; - int param = 42, paramReceived = int.MinValue; - var execute = new Action((i) => - { - execed = true; - }); - var can = new Predicate((i) => - { - executed = true; - paramReceived = i; - return false; - }); - - // execute - var target = new RelayCommand(execute, can, true); - target.Execute(param); - - // verify - Assert.IsFalse(execed, "Command executed execute"); - } - - [TestMethod] - public void CanExecutePreventsNotExecuteWorks() - { - // prepare - bool executed = false; - bool execed = false; - var execute = new Action(() => - { - execed = true; - }); - var can = new Func(() => - { - executed = true; - return false; - }); - - // execute - var target = new RelayCommand(execute, can, false); - target.Execute(null); - - // verify - Assert.IsTrue(execed, "Command executed execute"); - } - - [TestMethod] - public void CanExecutePreventsNotExecuteGenericWorks() - { - // prepare - bool executed = false; - bool execed = false; - int param = 42, paramReceived = int.MinValue; - var execute = new Action((i) => - { - execed = true; - }); - var can = new Predicate((i) => - { - executed = true; - paramReceived = i; - return false; - }); - - // execute - var target = new RelayCommand(execute, can, false); - target.Execute(param); - - // verify - Assert.IsTrue(execed, "Command executed execute"); - } - } -} diff --git a/Sources/NET4.SrkToolkit.Mvvm.Tests/ViewModelBaseTests.cs b/Sources/NET4.SrkToolkit.Mvvm.Tests/ViewModelBaseTests.cs deleted file mode 100644 index 61bb0f3..0000000 --- a/Sources/NET4.SrkToolkit.Mvvm.Tests/ViewModelBaseTests.cs +++ /dev/null @@ -1,110 +0,0 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace SrkToolkit.Mvvm.Tests -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Text; - using Microsoft.VisualStudio.TestTools.UnitTesting; - using SrkToolkit.Mvvm; - - [TestClass] - public class ViewModelBaseTests - { - [TestClass] - public class PropertyChangedEvent - { - [TestMethod, TestCategory(Category.Unit)] - public void ChangingPropertyValueViaSetValueNotifiesChange() - { - // prepare - var target = new ViewModelA(); - bool notified = false; - target.PropertyChanged += (s, e) => - { - if (e.PropertyName == "ViaSetValue") - notified = true; - }; - - // execute - target.ViaSetValue = true; - - // verify - Assert.AreEqual(true, target.ViaSetValue); - Assert.IsTrue(notified); - } - - [TestMethod, TestCategory(Category.Unit)] - public void ChangingPropertyValueViaRaisePropertyChangedNotifiesChange() - { - // prepare - var target = new ViewModelA(); - bool notified = false; - target.PropertyChanged += (s, e) => - { - if (e.PropertyName == "ViaRaisePropertyChanged") - notified = true; - }; - - // execute - target.ViaRaisePropertyChanged = true; - - // verify - Assert.AreEqual(true, target.ViaRaisePropertyChanged); - Assert.IsTrue(notified); - } - } - - [TestClass] - public class DispatchMethod - { - [TestMethod] - public void DoesNotThrowWhenDispatcherIsNull() - { - var target = new ViewModelA(); - target.Dispatcher = null; - target.Dispatch(() => { }); - } - } - - public class ViewModelA : ViewModelBase - { - private bool viaSetValue; - private bool viaRaisePropertyChanged; - - public bool ViaSetValue - { - get { return this.viaSetValue; } - set { this.SetValue(ref this.viaSetValue, value, "ViaSetValue"); } - } - - public bool ViaRaisePropertyChanged - { - get { return this.viaRaisePropertyChanged; } - set - { - if (this.viaRaisePropertyChanged != value) - { - this.viaRaisePropertyChanged = value; - this.RaisePropertyChanged("ViaRaisePropertyChanged"); - } - } - } - } - } -} diff --git a/Sources/SL4.SrkToolkit.Mvvm/Properties/AssemblyInfo.cs b/Sources/SL4.SrkToolkit.Mvvm/Properties/AssemblyInfo.cs deleted file mode 100644 index 94e3377..0000000 --- a/Sources/SL4.SrkToolkit.Mvvm/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System; - -[assembly: AssemblyTitle("SrkToolkit.Mvvm")] -[assembly: AssemblyDescription("SrkToolkit.Mvvm for SL4")] - -[assembly: CLSCompliant(true)] -[assembly: Guid("09f4eae2-e647-48e6-9a76-1d0d32752f6f")] diff --git a/Sources/SL4.SrkToolkit.Mvvm/SL4.SrkToolkit.Mvvm.csproj b/Sources/SL4.SrkToolkit.Mvvm/SL4.SrkToolkit.Mvvm.csproj deleted file mode 100644 index cb655be..0000000 --- a/Sources/SL4.SrkToolkit.Mvvm/SL4.SrkToolkit.Mvvm.csproj +++ /dev/null @@ -1,129 +0,0 @@ - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {09CD285E-A097-4C38-8598-5A9BE0557030} - {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} - Library - Properties - SrkToolkit.Mvvm - SrkToolkit.Mvvm - Silverlight - v5.0 - $(TargetFrameworkVersion) - false - true - true - - - - - 4.0 - - - - v3.5 - - - true - full - false - Bin\Debug - DEBUG;TRACE;SILVERLIGHT - true - true - prompt - 4 - Bin\Debug\SrkToolkit.Mvvm.XML - - - pdbonly - true - ..\..\Binaries\SL4\ - TRACE;SILVERLIGHT - true - true - prompt - 4 - ..\..\Binaries\SL4\SrkToolkit.Mvvm.xml - - - true - - - SrkToolkit.snk - - - - - - - - - - - - - SrkToolkit.Mvvm.AssemblyInfo.cs - - - Commands\RelayCommand.cs - - - Commands\RelayCommand.T.cs - - - InteractionViewModelBase.WP7.cs - - - PhoneApplicationPage.cs - - - PhoneAppNavigationState.cs - - - PhoneAppService.cs - - - ViewModelBase.cs - - - InteractionViewModelBase.cs - - - Tools\BusyTask.cs - - - Tools\BusyTaskCollection.cs - - - Tools\BusyTaskType.cs - - - Tools\IMessageBoxService.cs - - - Tools\MessageBoxService.cs - - - ViewModelBase.Common.cs - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Sources/SL4.SrkToolkit.Xaml/Behaviors/InputEnterBehavior.cs b/Sources/SL4.SrkToolkit.Xaml/Behaviors/InputEnterBehavior.cs deleted file mode 100644 index 14b43fc..0000000 --- a/Sources/SL4.SrkToolkit.Xaml/Behaviors/InputEnterBehavior.cs +++ /dev/null @@ -1,352 +0,0 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace SrkToolkit.Xaml.Behaviors -{ - using System; - using System.Windows; - using System.Windows.Controls; - using System.Windows.Data; - using System.Windows.Input; - using System.Windows.Interactivity; - using System.Windows.Threading; - - /// - /// Permits to focus the next input control when pressing enter. - /// A command can be associated instead of a next control for execution. - /// - public class InputEnterBehavior : Behavior, IDisposable - { - /// - /// Indicates the object was disposed. - /// - private bool disposed; - - #region Dependency property: Command - - /// - /// Gets or sets the command to execute when Enter key is pressed. - /// This is a dependency property. - /// - public ICommand Command - { - get { return (ICommand)GetValue(CommandProperty); } - set { SetValue(CommandProperty, value); } - } - - /// - /// The dependency property for the property. - /// - public static readonly DependencyProperty CommandProperty = - DependencyProperty.Register( - "Command", - typeof(ICommand), - typeof(InputEnterBehavior), - new PropertyMetadata(null)); - - #endregion - - #region Dependency property: CommandParameter - - /// - /// Gets or sets the command parameter. - /// This is a dependency property. - /// - public object CommandParameter - { - get { return (object)GetValue(CommandParameterProperty); } - set { SetValue(CommandParameterProperty, value); } - } - - /// - /// The dependency property for the property. - /// - public static readonly DependencyProperty CommandParameterProperty = - DependencyProperty.Register( - "CommandParameter", - typeof(object), - typeof(InputEnterBehavior), - new PropertyMetadata(null)); - - #endregion - - #region Dependency property: NextControl - - /// - /// Gets or sets the next control to focus when Enter key is pressed. - /// This is a dependency property. - /// - public Control NextControl - { - get { return (Control)GetValue(NextControlProperty); } - set { SetValue(NextControlProperty, value); } - } - - /// - /// The dependency property for the property. - /// - public static readonly DependencyProperty NextControlProperty = - DependencyProperty.Register( - "NextControl", - typeof(Control), - typeof(InputEnterBehavior), - new PropertyMetadata(null)); - - #endregion - - #region Dependency property: AcceptsEmpty - - /// - /// Gets or sets a value indicating whether to accept an empty input value. - /// - /// - /// true if to accept an empty input value; otherwise, false. - /// - public bool AcceptsEmpty - { - get { return (bool)GetValue(AcceptsEmptyProperty); } - set { SetValue(AcceptsEmptyProperty, value); } - } - - /// - /// The dependency property for the property. - /// - public static readonly DependencyProperty AcceptsEmptyProperty = - DependencyProperty.Register( - "AcceptsEmpty", - typeof(bool), - typeof(InputEnterBehavior), - new PropertyMetadata(false)); - - #endregion - - #region Dependency property: FocusOnLoaded - - /// - /// Gets or sets a value indicating whether to focus on this element when loaded. - /// This is a dependency property. - /// - public bool FocusOnLoaded - { - get { return (bool)GetValue(FocusOnLoadedProperty); } - set { SetValue(FocusOnLoadedProperty, value); } - } - - /// - /// The dependency property for the property. - /// - public static readonly DependencyProperty FocusOnLoadedProperty = - DependencyProperty.Register( - "FocusOnLoaded", - typeof(bool), - typeof(InputEnterBehavior), - new PropertyMetadata(false, OnFocusOnLoadedPropertyChanged)); - - #endregion - - /// - /// Occurs when [execute event]. - /// - public event EventHandler ExecuteEvent; - - #region IDisposable members - - /// - /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - /// - public void Dispose() - { - this.Dispose(true); - GC.SuppressFinalize(this); - } - - /// - /// Releases managed and - optionally - unmanaged resources - /// - /// true to release both managed and unmanaged resources; false to release only unmanaged resources. - protected virtual void Dispose(bool disposing) - { - if (!this.disposed) - { - if (disposing) - { - this.Cleanup(); - } - - this.disposed = true; - } - } - - #endregion - - /// - /// Called after the behavior is attached to an AssociatedObject. - /// - protected override void OnAttached() - { - base.OnAttached(); - - if (this.AssociatedObject is TextBox) - { - var textBox = (TextBox)this.AssociatedObject; - - textBox.KeyUp += this.OnKeyUp; - } - else if (this.AssociatedObject is PasswordBox) - { - var passBox = (PasswordBox)this.AssociatedObject; - - passBox.KeyUp += this.OnKeyUp; - } - - if (this.AssociatedObject is Control) - { - var ctrl = (Control)this.AssociatedObject; - - ctrl.Loaded += this.OnControlLoaded; - } - } - - /// - /// Called when the behavior is being detached from its AssociatedObject, but before it has actually occurred. - /// - protected override void OnDetaching() - { - this.Cleanup(); - - base.OnDetaching(); - } - - /// - /// Called when some dependency property values changes. - /// - /// The dependency object. - /// The instance containing the event data. - private static void OnFocusOnLoadedPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - var me = (InputEnterBehavior)d; - bool newValue = (bool)e.NewValue; - - if (newValue) - me.OnControlLoaded(me, new RoutedEventArgs()); - } - - private void Cleanup() - { - if (this.AssociatedObject is TextBox) - { - var textBox = (TextBox)this.AssociatedObject; - textBox.KeyUp -= this.OnKeyUp; - } - else if (this.AssociatedObject is PasswordBox) - { - var passBox = (PasswordBox)this.AssociatedObject; - passBox.KeyUp -= this.OnKeyUp; - } - - if (this.AssociatedObject is Control) - { - var ctrl = (Control)this.AssociatedObject; - - ctrl.Loaded -= this.OnControlLoaded; - } - - this.ExecuteEvent = null; - } - - /// - /// Called when [key up]. - /// - /// The event args. - private void OnKeyUp(object sender, KeyEventArgs e) - { -#if WINDOWS_PHONE - var isEnterKey = e.Key == Key.Enter || e.PlatformKeyCode == 10; -#else - var isEnterKey = e.Key == Key.Enter; -#endif - bool isEmpty = false; - - var inputTb = this.AssociatedObject as TextBox; - if (!this.AcceptsEmpty && inputTb != null) - { - isEmpty = string.IsNullOrEmpty(inputTb.Text); - } - var inputPb = this.AssociatedObject as PasswordBox; - if (!this.AcceptsEmpty && inputPb != null) - { - isEmpty = string.IsNullOrEmpty(inputPb.Password); - } - - // force databinding - BindingExpression binding = null; - if (inputTb != null) - { - binding = inputTb.GetBindingExpression(TextBox.TextProperty); - } - else if (inputPb != null) - { -#if SILVERLIGHT - binding = inputPb.GetBindingExpression(PasswordBox.PasswordProperty); -#endif - } - if (binding != null) - binding.UpdateSource(); - - // if any enter key is pressed - if (isEnterKey) - { - // don't do anything if the input must be filled - if (isEmpty) - return; - - if (this.NextControl != null) - { - // focus next control the best way we can - this.NextControl.Focus(); - - var tb = this.NextControl as TextBox; - if (tb != null) - tb.SelectAll(); - - var pb = this.NextControl as PasswordBox; - if (pb != null) - pb.SelectAll(); - } - else if (this.Command != null) - { - // execute the command - this.Command.Execute(this.CommandParameter); - } - else - { - // raise the event - var handler = this.ExecuteEvent; - if (handler != null) - handler(sender, e); - } - } - } - - private void OnControlLoaded(object sender, RoutedEventArgs e) - { - if (this.FocusOnLoaded && this.AssociatedObject is Control) - { - this.Dispatcher.BeginInvoke(() => ((Control)this.AssociatedObject).Focus()); - } - } - } -} diff --git a/Sources/SL4.SrkToolkit.Xaml/Behaviors/ListBoxScrollBehavior.cs b/Sources/SL4.SrkToolkit.Xaml/Behaviors/ListBoxScrollBehavior.cs deleted file mode 100644 index e29d586..0000000 --- a/Sources/SL4.SrkToolkit.Xaml/Behaviors/ListBoxScrollBehavior.cs +++ /dev/null @@ -1,307 +0,0 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace SrkToolkit.Xaml.Behaviors -{ - using System; - using System.Diagnostics; - using System.Linq; - using System.Windows; - using System.Windows.Controls; - using System.Windows.Data; - using System.Windows.Input; - using System.Windows.Interactivity; - - /// - /// This behaviors helps detect a is scrolled to the bottom by executing a . - /// - public class ListBoxScrollBehavior : Behavior - { - /// - /// The found within the ListBox. - /// - private ScrollViewer scrollViewer; - - #region Attached property ReachedBottomCommand - - /// - /// Gets the "reached bottom" command. - /// - /// The dependency object. - /// the command - public static ICommand GetReachedBottomCommand(DependencyObject obj) - { - return (ICommand)obj.GetValue(ReachedBottomCommandProperty); - } - - /// - /// Sets the "reached bottom" command. - /// - /// The dependency object. - /// The value. - public static void SetReachedBottomCommand(DependencyObject obj, ICommand value) - { - obj.SetValue(ReachedBottomCommandProperty, value); - } - - /// - /// The ReachedBottomCommand attached property. - /// - public static readonly DependencyProperty ReachedBottomCommandProperty = - DependencyProperty.RegisterAttached("ReachedBottomCommand", typeof(ICommand), typeof(ListBoxScrollBehavior), new PropertyMetadata(null)); - - #endregion - - #region Attached property ReachedBottomCommandParameter - - /// - /// Gets the reached bottom command parameter. - /// - /// The obj. - /// - public static object GetReachedBottomCommandParameter(DependencyObject obj) - { - return (object)obj.GetValue(ReachedBottomCommandParameterProperty); - } - - /// - /// Sets the reached bottom command parameter. - /// - /// The obj. - /// The value. - public static void SetReachedBottomCommandParameter(DependencyObject obj, object value) - { - obj.SetValue(ReachedBottomCommandParameterProperty, value); - } - - /// - /// The ReachedBottomCommandParameter attached property. - /// - public static readonly DependencyProperty ReachedBottomCommandParameterProperty = - DependencyProperty.RegisterAttached("ReachedBottomCommandParameter", typeof(object), typeof(ListBoxScrollBehavior), new PropertyMetadata(null)); - - #endregion - - #region Dependency property: StickToBottom - - public static bool GetStickToBottom(DependencyObject obj) - { - return (bool)obj.GetValue(StickToBottomProperty); - } - - public static void SetStickToBottom(DependencyObject obj, bool value) - { - obj.SetValue(StickToBottomProperty, value); - } - - public static readonly DependencyProperty StickToBottomProperty = - DependencyProperty.RegisterAttached("StickToBottom", typeof(bool), typeof(ListBoxScrollBehavior), new PropertyMetadata(false)); - - #endregion - - #region Attached property ListBoxScrollBehavior - - public static ListBoxScrollBehavior GetListBoxScrollBehavior(DependencyObject obj) - { - return (ListBoxScrollBehavior)obj.GetValue(ListBoxScrollBehaviorProperty); - } - - public static void SetListBoxScrollBehavior(DependencyObject obj, ListBoxScrollBehavior value) - { - obj.SetValue(ListBoxScrollBehaviorProperty, value); - } - - /// - /// The ListBoxScrollBehavior attached property. - /// - public static readonly DependencyProperty ListBoxScrollBehaviorProperty = - DependencyProperty.RegisterAttached("ListBoxScrollBehavior", typeof(ListBoxScrollBehavior), typeof(ListBoxScrollBehavior), new PropertyMetadata(null)); - - #endregion - - #region Attached property ScrollViewerVerticalOffset on ListBox - - /// - /// Gets the scroll viewer vertical offset. - /// - /// The dependency object. - /// - public static double GetScrollViewerVerticalOffset(DependencyObject obj) - { - return (double)obj.GetValue(ScrollViewerVerticalOffsetProperty); - } - - /// - /// Sets the scroll viewer vertical offset. - /// - /// The dependency object. - /// The value. - public static void SetScrollViewerVerticalOffset(DependencyObject obj, double value) - { - obj.SetValue(ScrollViewerVerticalOffsetProperty, value); - } - - /// - /// The ScrollViewerVerticalOffset attached property. - /// - public static readonly DependencyProperty ScrollViewerVerticalOffsetProperty = - DependencyProperty.RegisterAttached("ScrollViewerVerticalOffset", typeof(double), typeof(ListBox), new PropertyMetadata(double.NaN, OnVerticalOffsetPropertyChanged)); - - /// - /// Called when the scrollviewer's vertical offset property changed. - /// - /// The listbox. - /// The instance containing the event data. - private static void OnVerticalOffsetPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - var listbox = (ListBox)d; - var behavior = listbox.GetValue(ListBoxScrollBehaviorProperty) as ListBoxScrollBehavior; - behavior.OnVerticalOffsetChanged(); - } - - #endregion - - #region Attached property ScrollViewerScrollableHeightProperty on ListBox - - public static double GetScrollViewerScrollableHeight(DependencyObject obj) - { - return (double)obj.GetValue(ScrollViewerScrollableHeightProperty); - } - - public static void SetScrollViewerScrollableHeight(DependencyObject obj, double value) - { - obj.SetValue(ScrollViewerScrollableHeightProperty, value); - } - - public static readonly DependencyProperty ScrollViewerScrollableHeightProperty = - DependencyProperty.RegisterAttached("ScrollViewerScrollableHeight", typeof(double), typeof(ListBox), new PropertyMetadata(double.NaN, OnScrollableHeightPropertyChanged)); - - private static void OnScrollableHeightPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - var listbox = (ListBox)d; - var behavior = listbox.GetValue(ListBoxScrollBehaviorProperty) as ListBoxScrollBehavior; - behavior.OnScrollableHeightChanged(); - } - - #endregion - - /// - /// Called after the behavior is attached to an AssociatedObject. - /// - protected override void OnAttached() - { - if (this.AssociatedObject == null) - { - throw new InvalidOperationException("Could not find associated ListBox"); - } - - this.AssociatedObject.SetValue(ListBoxScrollBehaviorProperty, this); - this.AssociatedObject.Loaded += this.OnListboxLoaded; - } - - /// - /// Called when the behavior is being detached from its AssociatedObject, but before it has actually occurred. - /// - protected override void OnDetaching() - { - if (this.AssociatedObject != null) - { - this.AssociatedObject.Loaded -= this.OnListboxLoaded; - this.AssociatedObject.ClearValue(ListBoxScrollBehaviorProperty); - } - - this.scrollViewer = null; - } - - private void OnListboxLoaded(object sender, RoutedEventArgs e) - { - this.TryAttach(); - } - - public void TryAttach() - { - if (this.scrollViewer != null) - return; - - this.scrollViewer = this.AssociatedObject.GetChildrenRecursive().FirstOrDefault(); - if (this.scrollViewer != null) - { - this.AssociatedObject.Loaded -= this.OnListboxLoaded; - - { - var binding = new Binding(); - binding.Source = this.scrollViewer; - binding.Path = new PropertyPath("VerticalOffset", new object[0]); - binding.Mode = BindingMode.OneWay; - this.AssociatedObject.SetBinding(ScrollViewerVerticalOffsetProperty, binding); - } - - { - var binding = new Binding(); - binding.Source = this.scrollViewer; - binding.Path = new PropertyPath("ScrollableHeight", new object[0]); - binding.Mode = BindingMode.OneWay; - this.AssociatedObject.SetBinding(ScrollViewerScrollableHeightProperty, binding); - } - } - else - { - Trace.TraceWarning("ListBoxScrollBehavior: Could not find ScrollViever in associated ListBox"); - //throw new InvalidOperationException("Could not find ScrollViever in associated ListBox"); - return; - } - } - - /// - /// Called when the scrollviewer's vertical offset change. - /// - private void OnVerticalOffsetChanged() - { - // scrollable test - if (this.scrollViewer.ScrollableHeight > 0) - { - // end of scrollviewer test - // when using a virtualized stackpanel, VerticalOffset never gets greater than ScrollableHeight - // this is why I use an arbitrary margin - double margin = this.scrollViewer.ScrollableHeight / 20D; - if (this.scrollViewer.VerticalOffset >= this.scrollViewer.ScrollableHeight - || this.scrollViewer.VerticalOffset > margin - && (this.scrollViewer.VerticalOffset + margin) > this.scrollViewer.ScrollableHeight) - { - // command not-null test - var command = GetReachedBottomCommand(this); - if (command != null) - { - // command invocation - command.Execute(GetReachedBottomCommandParameter(this.AssociatedObject)); - } - } - } - } - - private void OnScrollableHeightChanged() - { - if (GetStickToBottom(this.AssociatedObject)) - { - double diff = this.scrollViewer.ScrollableHeight - this.scrollViewer.VerticalOffset; - if (Math.Abs(diff) > 1D) - { - this.scrollViewer.ScrollToVerticalOffset(this.scrollViewer.ScrollableHeight); - } - } - } - } -} diff --git a/Sources/SL4.SrkToolkit.Xaml/Extensions/DependencyObjectExtensions.cs b/Sources/SL4.SrkToolkit.Xaml/Extensions/DependencyObjectExtensions.cs deleted file mode 100644 index 6164f4c..0000000 --- a/Sources/SL4.SrkToolkit.Xaml/Extensions/DependencyObjectExtensions.cs +++ /dev/null @@ -1,76 +0,0 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace System.Windows -{ - using System.Collections.Generic; - using System.Windows.Media; - - /// - /// Extension methods for s. - /// - public static class DependencyObjectExtensions - { - /// - /// Gets the visual children of a with the specified type. - /// Stops recursion on object found. - /// - /// the type of object to find - /// The control. - /// if set to true stops recursion on object found; otherwise false. - /// - /// a collection of objects of the specified type - /// - public static IEnumerable GetChildrenRecursive(this DependencyObject control, bool stopRecursionOnObjectFound = true) - where T : DependencyObject - { - // for each child - for (int i = 0; i < VisualTreeHelper.GetChildrenCount(control); i++) - { - var child = VisualTreeHelper.GetChild(control, i); - - // child found? - if (child is T) - { - yield return (T)child; - - // stop recursion on found? - if (stopRecursionOnObjectFound) - break; - } - - // handle children of child - foreach (var item in child.GetChildrenRecursive()) - { - yield return item; - } - } - } - - public static T GetParent(this DependencyObject control) - where T : DependencyObject - { - DependencyObject parent = control; - while ((parent = VisualTreeHelper.GetParent(parent)) != null) - { - if (parent is T) - return (T)parent; - } - - return null; - } - } -} diff --git a/Sources/SL4.SrkToolkit.Xaml/Internal/DisposableEventHandler.cs b/Sources/SL4.SrkToolkit.Xaml/Internal/DisposableEventHandler.cs deleted file mode 100644 index 5a4e508..0000000 --- a/Sources/SL4.SrkToolkit.Xaml/Internal/DisposableEventHandler.cs +++ /dev/null @@ -1,43 +0,0 @@ - -namespace SrkToolkit.Xaml.Internal -{ - using System; - using System.Net; - using System.Windows; - using System.Windows.Controls; - using System.Windows.Documents; - using System.Windows.Ink; - using System.Windows.Input; - using System.Windows.Media; - using System.Windows.Media.Animation; - using System.Windows.Shapes; - - public class DisposableEventHandler : IDisposable - { - public static IDisposable FromEventPattern(Action addHandler, Action removeHandler) where TEventArgs : EventArgs - { - if (addHandler == null) - { - throw new ArgumentNullException("addHandler"); - } - if (removeHandler == null) - { - throw new ArgumentNullException("removeHandler"); - } - - return Observable.Create>(delegate(IObserver> observer) - { - EventHandler eventHandler = delegate(object sender, TEventArgs eventArgs) - { - observer.OnNext(new EventPattern(sender, eventArgs)); - }; - TDelegate d = (TDelegate)((object)Delegate.CreateDelegate(typeof(TDelegate), eventHandler, typeof(EventHandler).GetMethod("Invoke"))); - addHandler.Invoke(d); - return Disposable.Create(delegate - { - removeHandler.Invoke(d); - }); - }); - } - } -} diff --git a/Sources/SL4.SrkToolkit.Xaml/Properties/AssemblyInfo.cs b/Sources/SL4.SrkToolkit.Xaml/Properties/AssemblyInfo.cs deleted file mode 100644 index 26470c7..0000000 --- a/Sources/SL4.SrkToolkit.Xaml/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("SrkToolkit.Xaml for SL4")] -[assembly: AssemblyDescription("SrkToolkit.Xaml for SL4")] - -[assembly: Guid("2636e8d8-d0d6-40fc-be34-bfe392c7e325")] - diff --git a/Sources/SL4.SrkToolkit.Xaml/SL4.SrkToolkit.Xaml.csproj b/Sources/SL4.SrkToolkit.Xaml/SL4.SrkToolkit.Xaml.csproj deleted file mode 100644 index 46f0c56..0000000 --- a/Sources/SL4.SrkToolkit.Xaml/SL4.SrkToolkit.Xaml.csproj +++ /dev/null @@ -1,104 +0,0 @@ - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {F156F957-A86C-43BD-8957-29F464BFBED0} - {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} - Library - Properties - SrkToolkit.Xaml - SrkToolkit.Xaml - Silverlight - v5.0 - $(TargetFrameworkVersion) - false - true - true - - - - - 4.0 - - - - v3.5 - - - true - full - false - Bin\Debug - DEBUG;TRACE;SILVERLIGHT - true - true - prompt - 4 - - - pdbonly - true - ..\..\Binaries\SL4\ - TRACE;SILVERLIGHT - true - true - prompt - 4 - ..\..\Binaries\SL4\SrkToolkit.Xaml.xml - - - - - - - - - - - - - - Properties\SrkToolkit.Xaml.AssemblyInfo.cs - - - Internal\Trace.cs - - - Converters\BoolToVisibilityConverter.cs - - - Converters\DateTimeDateConverter.cs - - - Converters\NotNullToVisibilityConverter.cs - - - Converters\OppositeBoolConverter.cs - - - Converters\ToLowerConverter.cs - - - Converters\ToUpperConverter.cs - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Sources/SL5.SrkToolkit.Xaml/Properties/AssemblyInfo.cs b/Sources/SL5.SrkToolkit.Xaml/Properties/AssemblyInfo.cs deleted file mode 100644 index 7087791..0000000 --- a/Sources/SL5.SrkToolkit.Xaml/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("SrkToolkit.Xaml")] -[assembly: AssemblyDescription("SrkToolkit.Xaml for SL5")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("SL5.SrkToolkit.Xaml")] -[assembly: AssemblyCopyright("Copyright © 2012")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -[assembly: ComVisible(false)] - -[assembly: Guid("0b1032d9-9f0c-49d3-b2bd-13e1dfca3e2c")] - -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Sources/SL5.SrkToolkit.Xaml/SL5.SrkToolkit.Xaml.csproj b/Sources/SL5.SrkToolkit.Xaml/SL5.SrkToolkit.Xaml.csproj deleted file mode 100644 index 4bf2b77..0000000 --- a/Sources/SL5.SrkToolkit.Xaml/SL5.SrkToolkit.Xaml.csproj +++ /dev/null @@ -1,102 +0,0 @@ - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {913047F4-1361-428D-997E-E8A6707B5ECA} - {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} - Library - Properties - SrkToolkit.Xaml - SrkToolkit.Xaml - Silverlight - v5.0 - $(TargetFrameworkVersion) - false - true - true - - - - v3.5 - - - true - full - false - Bin\Debug - DEBUG;TRACE;SILVERLIGHT - true - true - prompt - 4 - - - pdbonly - true - ..\..\Binaries\SL5\ - TRACE;SILVERLIGHT - true - true - prompt - 4 - ..\..\Binaries\SL5\SrkToolkit.Xaml.xml - - - - - - - - ..\Libs-SL5\System.Windows.Interactivity.dll - - - - - - - - InputEnterBehavior.cs - - - ListBoxScrollBehavior.cs - - - DependencyObjectExtensions.cs - - - CompositeDisposable.cs - - - BoolToVisibilityConverter.cs - - - DateTimeDateConverter.cs - - - NotNullToVisibilityConverter.cs - - - OppositeBoolConverter.cs - - - ToLowerConverter.cs - - - ToUpperConverter.cs - - - - - - - - - - - - \ No newline at end of file diff --git a/Sources/SrkToolkit.Xaml.AssemblyInfo.cs b/Sources/SrkToolkit.Xaml.AssemblyInfo.cs deleted file mode 100644 index da3a7e5..0000000 --- a/Sources/SrkToolkit.Xaml.AssemblyInfo.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -#if DEBUG -[assembly: AssemblyConfiguration("DEBUG")] -#endif -#if RELEASE -[assembly: AssemblyConfiguration("RELEASE")] -#endif - -[assembly: AssemblyCompany("SandRock")] -[assembly: AssemblyProduct("SrkToolkit")] -[assembly: AssemblyCopyright("Copyright © SandRock 2011")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -[assembly: ComVisible(false)] - -[assembly: AssemblyVersion("1.1.0.0")] -[assembly: AssemblyFileVersion("1.1.0.0")] diff --git a/Sources/UWP461.SrkToolkit.Mvvm/NavigationService.UWP.cs b/Sources/UWP461.SrkToolkit.Mvvm/NavigationService.UWP.cs deleted file mode 100644 index 683cef8..0000000 --- a/Sources/UWP461.SrkToolkit.Mvvm/NavigationService.UWP.cs +++ /dev/null @@ -1,55 +0,0 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace SrkToolkit.Mvvm -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Text; - using System.Threading.Tasks; - using Windows.UI.Xaml.Controls; - - public class NavigationService : IDisposable - { - private Frame frame; - private bool isDisposed; - - public NavigationService(Frame frame) - { - this.frame = frame; - } - - public void Dispose() - { - this.Dispose(true); - GC.SuppressFinalize(this); - } - - protected virtual void Dispose(bool disposing) - { - if (!this.isDisposed) - { - if (disposing) - { - this.frame = null; - } - - this.isDisposed = true; - } - } - } -} diff --git a/Sources/UWP461.SrkToolkit.Mvvm/Page.UWP.cs b/Sources/UWP461.SrkToolkit.Mvvm/Page.UWP.cs deleted file mode 100644 index 406cd62..0000000 --- a/Sources/UWP461.SrkToolkit.Mvvm/Page.UWP.cs +++ /dev/null @@ -1,99 +0,0 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace SrkToolkit.Mvvm -{ - using System; - using System.Collections.Generic; - using System.Text; - using Windows.UI.Xaml; - using Windows.UI.Xaml.Controls; - using Windows.UI.Xaml.Media; - - /// - /// Custom page to use with . - /// - public class Page : Windows.UI.Xaml.Controls.Page - { - /// - /// Initializes a new instance of the class. - /// - public Page() - : base() - { - this.DataContextChanged += this.OnDataContextChanged; - ////Windows.UI.ViewManagement.ApplicationView.GetForCurrentView(); - this.Loaded += this.OnLoaded; - this.Unloaded += this.OnUnloaded; - } - - private ViewModelBase InternalViewModel - { - get { return this.DataContext as ViewModelBase; } - } - - protected virtual void OnLoaded(object sender, RoutedEventArgs e) - { - var model = this.InternalViewModel; - if (model != null) - { - this.ResolveNavigationServiceIntoModel(model); - } - } - - protected virtual void OnUnloaded(object sender, RoutedEventArgs e) - { - var model = this.InternalViewModel; - if (model != null) - { - var service = model.NavigationService; - if (service != null) - { - service.Dispose(); - model.NavigationService = null; - } - } - } - - protected virtual void OnDataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args) - { - var model = args.NewValue as ViewModelBase; - if (model != null) - { - this.ResolveNavigationServiceIntoModel(model); - } - } - - private void ResolveNavigationServiceIntoModel(ViewModelBase model) - { - DependencyObject parent = this; - Frame frame = null; - while (parent != null && frame == null) - { - parent = VisualTreeHelper.GetParent(parent); - if (parent is Frame) - { - frame = (Frame)parent; - } - } - - if (frame != null && model != null) - { - model.NavigationService = new NavigationService(frame); - } - } - } -} diff --git a/Sources/UWP461.SrkToolkit.Mvvm/Properties/AssemblyInfo.cs b/Sources/UWP461.SrkToolkit.Mvvm/Properties/AssemblyInfo.cs deleted file mode 100644 index 8b7c741..0000000 --- a/Sources/UWP461.SrkToolkit.Mvvm/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Resources; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System; - -[assembly: AssemblyTitle("SrkToolkit.Mvvm for UWP 4.6.1")] -[assembly: AssemblyDescription("SrkToolkit.Mvvm for UWP 4.6.1")] - -[assembly: CLSCompliant(true)] -[assembly: Guid("757F5201-8C1A-44F0-A7B0-C963788C874E")] - -////[assembly: NeutralResourcesLanguage("en")] diff --git a/Sources/UWP461.SrkToolkit.Mvvm/Services/PagesServiceBase.cs b/Sources/UWP461.SrkToolkit.Mvvm/Services/PagesServiceBase.cs deleted file mode 100644 index 29a6377..0000000 --- a/Sources/UWP461.SrkToolkit.Mvvm/Services/PagesServiceBase.cs +++ /dev/null @@ -1,94 +0,0 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace SrkToolkit.Mvvm.Services -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Text; - using System.Threading.Tasks; - - /// - /// Services around pages. - /// - public class PagesServiceBase - { - private static PagesServiceBase defaultInstance; - - private readonly Dictionary modelToPage = new Dictionary(); - - public PagesServiceBase() - { - } - - public static PagesServiceBase Default - { - get { return defaultInstance ?? (defaultInstance = new PagesServiceBase()); } - } - - public PagesServiceBase RegisterPageAndModel() - { - return this.RegisterPageAndModel(null); - } - - public PagesServiceBase RegisterPageAndModel(string url) - { - var page = typeof(TPage); - var model = typeof(TModel); - if (!this.modelToPage.ContainsKey(model)) - { - this.modelToPage.Add(model, page); - } - - return this; - } - - public object CreateModel() - { - var page = typeof(TPage); - Type modelType = null; - foreach (var item in this.modelToPage) - { - if (item.Value == page) - { - modelType = item.Key; - break; - } - } - - if (modelType != null) - { - return Activator.CreateInstance(modelType); - } - else - { - return null; - } - } - - public Type GetModelsPageType() - { - var model = typeof(TModel); - if (this.modelToPage.ContainsKey(model)) - { - return this.modelToPage[model]; - } - - return null; - } - } -} diff --git a/Sources/UWP461.SrkToolkit.Mvvm/UWP461.SrkToolkit.Mvvm.csproj b/Sources/UWP461.SrkToolkit.Mvvm/UWP461.SrkToolkit.Mvvm.csproj deleted file mode 100644 index ebcedf5..0000000 --- a/Sources/UWP461.SrkToolkit.Mvvm/UWP461.SrkToolkit.Mvvm.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - - 12.0 - Debug - AnyCPU - {1B365EA8-743C-4105-B86D-FF412DAD0DAF} - Library - Properties - SrkToolkit.Mvvm - SrkToolkit.Mvvm - en-US - 512 - {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Profile32 - v4.6 - - - true - full - false - bin\Debug\ - TRACE;DEBUG;UWP - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE;UWP - prompt - 4 - - - true - - - SrkToolkit.snk - - - - - - - - - - - - Properties\SrkToolkit.Mvvm.AssemblyInfo.cs - - - Commands\RelayCommand.cs - - - Commands\RelayCommand.T.cs - - - - - - - DispatcherExtensions.cs - - - GlobalSuppressions.cs - - - InteractionViewModelBase.cs - - - Tools\BusyTask.cs - - - Tools\BusyTaskCollection.cs - - - Tools\BusyTaskType.cs - - - ViewModelBase.Common.cs - - - - - - - \ No newline at end of file diff --git a/Sources/UWP461.SrkToolkit.Mvvm/ViewModelBase.cs b/Sources/UWP461.SrkToolkit.Mvvm/ViewModelBase.cs deleted file mode 100644 index a945020..0000000 --- a/Sources/UWP461.SrkToolkit.Mvvm/ViewModelBase.cs +++ /dev/null @@ -1,33 +0,0 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace SrkToolkit.Mvvm -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Threading.Tasks; - using Windows.UI.Xaml.Controls; - - public partial class ViewModelBase - { - public void NavigateToPage(Type pageType) - { - } - - public NavigationService NavigationService { get; set; } - } -} diff --git a/Sources/UWP461.SrkToolkit.Xaml/Properties/AssemblyInfo.cs b/Sources/UWP461.SrkToolkit.Xaml/Properties/AssemblyInfo.cs deleted file mode 100644 index a5cbf11..0000000 --- a/Sources/UWP461.SrkToolkit.Xaml/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System.Resources; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("SrkToolkit.Xaml for UWP 4.6.1")] -[assembly: AssemblyDescription("SrkToolkit.Xaml for UWP 4.6.1")] - -[assembly: NeutralResourcesLanguage("en")] diff --git a/Sources/UWP461.SrkToolkit.Xaml/UWP461.SrkToolkit.Xaml.csproj b/Sources/UWP461.SrkToolkit.Xaml/UWP461.SrkToolkit.Xaml.csproj deleted file mode 100644 index dd4f840..0000000 --- a/Sources/UWP461.SrkToolkit.Xaml/UWP461.SrkToolkit.Xaml.csproj +++ /dev/null @@ -1,70 +0,0 @@ - - - - - 12.0 - Debug - AnyCPU - {24E9D52C-6679-47E1-A2C6-6FEB34C79712} - Library - Properties - SrkToolkit.Xaml - SrkToolkit.Xaml - en-US - 512 - {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Profile32 - v4.6 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - true - - - SrkToolkit.snk - - - - - - - - - - - - Properties\SrkToolkit.Xaml.AssemblyInfo.cs - - - - - - - - - - - - \ No newline at end of file diff --git a/Sources/WP7.SrkToolkit.Mvvm/Commands/RelayCommand.T.cs b/Sources/WP7.SrkToolkit.Mvvm/Commands/RelayCommand.T.cs deleted file mode 100644 index 9562bed..0000000 --- a/Sources/WP7.SrkToolkit.Mvvm/Commands/RelayCommand.T.cs +++ /dev/null @@ -1,99 +0,0 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace SrkToolkit.Mvvm.Commands -{ - using System; - using System.Windows.Input; - using System.Diagnostics; - - /// - /// Classic generic RelayCommand implementation for the MVVM pattern. - /// - public class RelayCommand : ICommand - { - private readonly Predicate _canExecuteFunc; - private readonly Action _executeAction; - private readonly bool canExecutePreventsExecute; - - /// - /// Event for the CanExecute feature. - /// - public event EventHandler CanExecuteChanged; - - /// - /// Create a new instance that can always execute. - /// - /// the action to execute - /// If the execute argument is null. - [DebuggerStepThrough] - public RelayCommand(Action execute) - { - if (execute == null) - { - throw new ArgumentNullException("execute"); - } - this._executeAction = execute; - } - - /// - /// Initializes a new instance of the RelayCommand class. - /// - /// The execution logic. - /// The execution status logic. - /// If the execute argument is null. - [DebuggerStepThrough] - public RelayCommand(Action execute, Predicate canExecute, bool canExecutePreventsExecute) - { - if (execute == null) - { - throw new ArgumentNullException("execute"); - } - this._executeAction = execute; - this._canExecuteFunc = canExecute; - this.canExecutePreventsExecute = canExecutePreventsExecute; - } - - /// - /// Defines the method that determines whether the command can execute in its current state. - /// - /// This parameter will always be ignored. - /// true if this command can be executed; otherwise, false. - [DebuggerStepThrough] - public bool CanExecute(object parameter) - { - return ((this._canExecuteFunc == null) ? true : this._canExecuteFunc.Invoke((T)parameter)); - } - - /// - /// Defines the method to be called when the command is invoked. - /// - /// This parameter will always be ignored. - [DebuggerStepThrough] - public void Execute(object parameter) - { - if (this.canExecutePreventsExecute && this._canExecuteFunc != null) - { - if (this._canExecuteFunc((T)parameter)) - this._executeAction.Invoke((T)parameter); - } - else - { - this._executeAction.Invoke((T)parameter); - } - } - } -} diff --git a/Sources/WP7.SrkToolkit.Mvvm/Commands/RelayCommand.cs b/Sources/WP7.SrkToolkit.Mvvm/Commands/RelayCommand.cs deleted file mode 100644 index 035d575..0000000 --- a/Sources/WP7.SrkToolkit.Mvvm/Commands/RelayCommand.cs +++ /dev/null @@ -1,99 +0,0 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace SrkToolkit.Mvvm.Commands -{ - using System; - using System.Windows.Input; - using System.Diagnostics; - using System.Threading.Tasks; - - /// - /// Classic RelayCommand implementation for the MVVM pattern. - /// - public class RelayCommand : ICommand - { - private readonly Action _executeAction; - private readonly Func _canExecuteFunc; - private readonly bool canExecutePreventsExecute; - - /// - /// Event for the CanExecute feature. - /// - public event EventHandler CanExecuteChanged; - - /// - /// Create a new instance that can always execute. - /// - /// the action to execute - /// If the execute argument is null. - [DebuggerStepThrough] - public RelayCommand(Action execute) - { - if (execute == null) - { - throw new ArgumentNullException("execute"); - } - this._executeAction = execute; - } - - /// - /// Initializes a new instance of the RelayCommand class. - /// - /// The execution logic. - /// The execution status logic. - /// If the execute argument is null. - [DebuggerStepThrough] - public RelayCommand(Action execute, Func canExecute, bool canExecutePreventsExecute) - { - if (execute == null) - { - throw new ArgumentNullException("execute"); - } - this._executeAction = execute; - this._canExecuteFunc = canExecute; - this.canExecutePreventsExecute = canExecutePreventsExecute; - } - - [DebuggerStepThrough] - public static RelayCommand Create(Func execute, Func canExecute, bool canExecutePreventsExecute) - { - return new RelayCommand(() => execute(), canExecute, canExecutePreventsExecute); - } - - /// - /// Defines the method that determines whether the command can execute in its current state. - /// - /// This parameter will always be ignored. - /// true if this command can be executed; otherwise, false. - [DebuggerStepThrough] - public bool CanExecute(object parameter) - { - return ((this._canExecuteFunc == null) ? true : this._canExecuteFunc.Invoke()); - } - - /// - /// Defines the method to be called when the command is invoked. - /// - /// This parameter will always be ignored. - [DebuggerStepThrough] - public void Execute(object parameter) - { - if (_canExecuteFunc == null || (this.canExecutePreventsExecute && _canExecuteFunc())) - this._executeAction.Invoke(); - } - } -} diff --git a/Sources/WP7.SrkToolkit.Mvvm/GlobalSuppressions.cs b/Sources/WP7.SrkToolkit.Mvvm/GlobalSuppressions.cs deleted file mode 100644 index 8719701..0000000 --- a/Sources/WP7.SrkToolkit.Mvvm/GlobalSuppressions.cs +++ /dev/null @@ -1,26 +0,0 @@ -// This file is used by Code Analysis to maintain SuppressMessage -// attributes that are applied to this project. -// Project-level suppressions either have no target or are given -// a specific target and scoped to a namespace, type, member, etc. -// -// To add a suppression to this file, right-click the message in the -// Error List, point to "Suppress Message(s)", and click -// "In Project Suppression File". -// You do not need to add suppressions to this file manually. - -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "SrkToolkit.Base")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Srk", Scope = "namespace", Target = "SrkToolkit.Base")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "SrkToolkit.Mvvm")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Mvvm", Scope = "namespace", Target = "SrkToolkit.Mvvm")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Srk", Scope = "namespace", Target = "SrkToolkit.Mvvm")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "SrkToolkit.Mvvm.Commands")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Mvvm", Scope = "namespace", Target = "SrkToolkit.Mvvm.Commands")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Srk", Scope = "namespace", Target = "SrkToolkit.Mvvm.Commands")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "SrkToolkit.Mvvm.Tools")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Mvvm", Scope = "namespace", Target = "SrkToolkit.Mvvm.Tools")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Srk", Scope = "namespace", Target = "SrkToolkit.Mvvm.Tools")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Mvvm")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Srk")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Mbox", Scope = "member", Target = "SrkToolkit.Mvvm.InteractionViewModelBase.#Mbox")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1045:DoNotPassTypesByReference", MessageId = "0#", Scope = "member", Target = "SrkToolkit.Mvvm.ViewModelBase.#SetValue`1(!!0&,!!0,System.String)")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods", Scope = "member", Target = "SrkToolkit.Mvvm.Tools.BusyTask.#Type")] diff --git a/Sources/WP7.SrkToolkit.Mvvm/InteractionViewModelBase.WP7.cs b/Sources/WP7.SrkToolkit.Mvvm/InteractionViewModelBase.WP7.cs deleted file mode 100644 index a080ea7..0000000 --- a/Sources/WP7.SrkToolkit.Mvvm/InteractionViewModelBase.WP7.cs +++ /dev/null @@ -1,311 +0,0 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace SrkToolkit.Mvvm -{ - using System; - using System.Collections.Generic; - using System.ComponentModel; - using System.Windows; - using System.Windows.Input; - using System.Windows.Navigation; - using Microsoft.Phone.Controls; - using Microsoft.Phone.Tasks; - using SrkToolkit.Mvvm.Commands; - - partial class InteractionViewModelBase - { - private NavigationService navigationService; - - /// - /// This property allows you to save transient state data on your page. - /// - /// - /// The state of the page. - /// - internal protected IDictionary PageState { get; internal set; } - - /// - /// Gets the number of times was invoked. - /// - protected int Navigations { get; private set; } - - /// - /// Gets a value indicating whether this instance is navigated for the first time (just created). - /// - /// - /// true if this instance is navigated for the first time (just created); otherwise, false. - /// - protected bool IsFirstPageInstanceNavigation - { - get { return this.Navigations == 1; } - } - - #region Phone commands - - #region Navigate Command - - /// - /// Useless thing. - /// - [CLSCompliant(false)] - protected static PhoneApplicationFrame RootVisual - { - get - { - return Application.Current.RootVisual as PhoneApplicationFrame; - } - } - - /// - /// Navigate to any page in the application. - /// To be bound in the view. - /// You can pass a string or a Uri as parameter. - /// - public ICommand NavigateCommand - { - get - { - if (this._navigateCommand == null) - { - if (this.baseViewModel != null && this.baseViewModel._navigateCommand != null) - return this.baseViewModel._navigateCommand; - - this._navigateCommand = new RelayCommand(this.OnNavigate); - } - return _navigateCommand; - } - } - private ICommand _navigateCommand; - - private void OnNavigate(object param) - { - Uri uri = param as Uri; - - if (uri == null && param is string) { - uri = new Uri((string)param, UriKind.Relative); - } - - if (uri != null) { - RootVisual.Navigate(uri); - } - } - - /// - /// Navigates to the most recent entry in the back navigation history. - /// - /// - /// if going back is not allowed, this param will be used to navigate somewhere else. - /// - /// - /// this.NavigateBack("/Pages/MainPage.xaml"); - /// - protected void NavigateBack(string fallbackUri) { - if (this.NavigationService.CanGoBack) { - this.NavigationService.GoBack(); - } else if (fallbackUri != null) { - if (fallbackUri == null) - throw new ArgumentNullException("fallbackUri"); - - this.NavigateBack(new Uri(fallbackUri, UriKind.Relative)); - } - } - - /// - /// Navigates to the most recent entry in the back navigation history. - /// - /// - /// if going back is not allowed, this param will be used to navigate somewhere else. - /// - protected void NavigateBack(Uri fallbackUri) - { - if (this.NavigationService.CanGoBack) { - this.NavigationService.GoBack(); - } else if (fallbackUri != null) { - if (fallbackUri == null) - throw new ArgumentNullException("fallbackUri"); - - this.NavigationService.Navigate(fallbackUri); - } - } - - #endregion - - #region Browser link - - /// - /// Web browser link. - /// To be bound in the view. - /// - public ICommand WebLinkCommand - { - get - { - if (_linkCommand == null) - { - if (this.baseViewModel != null && this.baseViewModel._linkCommand != null) - return this.baseViewModel._linkCommand; - - _linkCommand = new RelayCommand(OnWebLinkPrivate); - } - return _linkCommand; - } - } - private ICommand _linkCommand; - - private void OnWebLinkPrivate(object param) - { - Uri uri = null; - if (param is Uri) - uri = (Uri)param; - if (param is string) - uri = new Uri((string)param, UriKind.Absolute); - - if (OnWebLink(uri)) - { - var webTask = new WebBrowserTask(); - webTask.URL = uri.OriginalString; - webTask.Show(); - } - } - - /// - /// Called when the is executed. - /// - /// The URL. - /// - /// if the returned value is true, then a will be xecuted for the specified url. - /// - protected virtual bool OnWebLink(Uri url) - { - return true; - } - - #endregion - - #endregion - - #region View events - - /// - /// Nice for navigation. - /// - [CLSCompliant(false)] - protected NavigationService NavigationService - { - get { return this.navigationService ?? (this.baseViewModel != null && this.baseViewModel.navigationService != null ? this.baseViewModel.navigationService : null); } - private set { this.navigationService = value; } - } - - /// - /// Gets or sets a value indicating whether this page is deactivated. - /// - /// - /// true if this instance is page deactivated; otherwise, false. - /// - public virtual bool IsPageDeactivated - { - get - { -#if DEBUG - if (System.Diagnostics.Debugger.IsAttached && _isPageDeactivated) - System.Diagnostics.Debugger.Break(); // breaking here means a page still works even if no more displayed -#endif - return this._isPageDeactivated; - } - set { this._isPageDeactivated = value; } - } - private bool _isPageDeactivated; - - /// - /// Called when a page is no longer the active page in a frame. - /// - /// An object that contains the event data. - internal protected virtual void OnNavigatedFrom(NavigationEventArgs e) - { - this.IsPageDeactivated = true; - } - - /// - /// Called when a page becomes the active page in a frame. - /// Set the property. - /// - /// An object that contains the event data. - /// The navigation context. - /// The navigation service. - [CLSCompliant(false)] - internal protected virtual void OnNavigatedTo(NavigationEventArgs e, NavigationContext context, NavigationService navigationService) - { - this.Navigations++; - this.NavigationService = navigationService; - this.IsPageDeactivated = false; - } - - /// - /// Called just before a page is no longer the active page in a frame. - /// - /// An object that contains the event data. - internal protected virtual void OnNavigatingFrom(NavigatingCancelEventArgs e) - { - } - - /// - /// Called when navigating to a fragment on a page. - /// - /// An object that contains the event data. - [CLSCompliant(false)] - internal protected virtual void OnFragmentNavigation(FragmentNavigationEventArgs e) - { - } - - /// - /// This method is called when the hardware back key is pressed. - /// - /// Set e.Cancel to true to indicate that the request was handled by the application. - internal protected virtual void OnBackKeyPress(CancelEventArgs e) - { - } - - #endregion - -#if !WP80 - - /// - /// Occurs when a visual state change is commanded. - /// - public event EventHandler VisualStateChangeEvent; - - /// - /// Commands a visual state change. - /// - /// Name of the state. - /// if set to true use transitions. - /// - /// true is the transition succeed; otherwise, false - /// - protected bool GoToVisualState(string stateName, bool useTransitions = true) - { - var args = new VisualStateChangeEventArgs(stateName, useTransitions); - var handler = this.VisualStateChangeEvent; - if (handler != null) - handler(this, args); - - return args.Succeed; - } - -#endif - } -} diff --git a/Sources/WP7.SrkToolkit.Mvvm/PhoneAppNavigationState.cs b/Sources/WP7.SrkToolkit.Mvvm/PhoneAppNavigationState.cs deleted file mode 100644 index a9e885a..0000000 --- a/Sources/WP7.SrkToolkit.Mvvm/PhoneAppNavigationState.cs +++ /dev/null @@ -1,59 +0,0 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace SrkToolkit.Mvvm -{ - /// - /// Navigation states for a Windows Phone 7 application. - /// - public enum PhoneAppNavigationState - { - /// - /// Before the first navigation of the application lifetime (ephemeral state). - /// - Starting, - - /// - /// First navigation of the application lifetime. - /// - Started, - - /// - /// Internal navigation. - /// - Internal, - - /// - /// Before the application is activated (ephemeral state). - /// - Activated, - - /// - /// Application is activated. - /// - Activating, - - /// - /// The application is deactivated. - /// - Deactivated, - - /// - /// The application is closed. - /// - Closed, - } -} diff --git a/Sources/WP7.SrkToolkit.Mvvm/PhoneAppService.cs b/Sources/WP7.SrkToolkit.Mvvm/PhoneAppService.cs deleted file mode 100644 index 776d56e..0000000 --- a/Sources/WP7.SrkToolkit.Mvvm/PhoneAppService.cs +++ /dev/null @@ -1,112 +0,0 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace SrkToolkit.Mvvm -{ - using System; - using System.Windows; - using System.Windows.Navigation; - using Microsoft.Phone.Controls; - using Microsoft.Phone.Shell; - - /// - /// Windows Phone application related services. - /// - public class PhoneAppService - { - /// - /// Gets the navigation state. - /// - /// - /// The navigation state. - /// - public static PhoneAppNavigationState NavigationState { get; private set; } - - /// - /// Setups the NavigationState service. - /// To be called one time at the end of the App class contrustor. - /// - public static void Setup() - { - Setup(Application.Current); - } - - /// - /// Setups the NavigationState service. - /// To be called one time at the end of the App class contrustor. - /// - public static void Setup(Application application) - { - application.Exit += OnAppExit; - application.Startup += OnAppStartup; - - var appService = PhoneApplicationService.Current; - if (appService != null) - { - appService.Activated += OnAppActivated; - appService.Deactivated += OnAppDeactivated; - appService.Launching += OnAppLaunching; - appService.Closing += OnAppClosing; - } - - var frame = application.RootVisual as PhoneApplicationFrame; - if (frame != null) - { - frame.Navigated += OnFrameNavigated; - } - } - - static void OnAppStartup(object sender, StartupEventArgs e) - { - } - - static void OnAppLaunching(object sender, LaunchingEventArgs e) - { - NavigationState = PhoneAppNavigationState.Starting; - } - - static void OnAppActivated(object sender, ActivatedEventArgs e) - { - NavigationState = PhoneAppNavigationState.Activating; - } - - static void OnAppDeactivated(object sender, DeactivatedEventArgs e) - { - NavigationState = PhoneAppNavigationState.Deactivated; - } - - static void OnAppClosing(object sender, ClosingEventArgs e) - { - NavigationState = PhoneAppNavigationState.Closed; - } - - static void OnFrameNavigated(object sender, NavigationEventArgs e) - { - if (NavigationState == PhoneAppNavigationState.Activated) - NavigationState = PhoneAppNavigationState.Internal; - else if (NavigationState == PhoneAppNavigationState.Activating) - NavigationState = PhoneAppNavigationState.Activated; - else if (NavigationState == PhoneAppNavigationState.Starting) - NavigationState = PhoneAppNavigationState.Started; - else - NavigationState = PhoneAppNavigationState.Internal; - } - - static void OnAppExit(object sender, EventArgs e) - { - } - } -} diff --git a/Sources/WP7.SrkToolkit.Mvvm/PhoneApplicationPage.cs b/Sources/WP7.SrkToolkit.Mvvm/PhoneApplicationPage.cs deleted file mode 100644 index be38ad6..0000000 --- a/Sources/WP7.SrkToolkit.Mvvm/PhoneApplicationPage.cs +++ /dev/null @@ -1,149 +0,0 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace SrkToolkit.Mvvm -{ - using System; - using System.ComponentModel; - using System.Windows; - using System.Windows.Navigation; - - /// - /// Custom page to use with . - /// - [CLSCompliant(false)] - public class PhoneApplicationPage : Microsoft.Phone.Controls.PhoneApplicationPage - { - /// - /// Initializes a new instance of the class. - /// - public PhoneApplicationPage() - : base() - { - } - - /// - /// Gets a value indicating whether the current theme is light. - /// - /// - /// true if the current theme is light; otherwise, false. - /// - public bool LightThemeEnabled - { - get - { - return (Visibility)Application.Current.Resources["PhoneLightThemeVisibility"] == Visibility.Visible; - } - } - - /// - /// This method is called when the hardware back key is pressed. - /// - /// Set e.Cancel to true to indicate that the request was handled by the application. - protected override void OnBackKeyPress(CancelEventArgs e) - { - if (this.DataContext != null && this.DataContext is InteractionViewModelBase) - { - ((InteractionViewModelBase)this.DataContext).OnBackKeyPress(e); - } - - base.OnBackKeyPress(e); - } - - /// - /// Called when a page is no longer the active page in a frame. - /// - /// An object that contains the event data. - protected override void OnNavigatedFrom(NavigationEventArgs e) - { - if (this.DataContext != null && this.DataContext is InteractionViewModelBase) - { - var vm = (InteractionViewModelBase)this.DataContext; -#if !WP80 - vm.VisualStateChangeEvent -= this.OnVisualStateChange; -#endif - vm.OnNavigatedFrom(e); - vm.PageState = null; - } - - base.OnNavigatedFrom(e); - } - - /// - /// Called when a page becomes the active page in a frame. - /// - /// An object that contains the event data. - protected override void OnNavigatedTo(NavigationEventArgs e) - { - base.OnNavigatedTo(e); - - if (this.DataContext != null && this.DataContext is InteractionViewModelBase) - { - var vm = (InteractionViewModelBase)this.DataContext; -#if !WP80 - vm.VisualStateChangeEvent += this.OnVisualStateChange; -#endif - vm.PageState = this.State; - vm.OnNavigatedTo(e, NavigationContext, NavigationService); - } - } - - /// - /// Called when navigating to a fragment on a page. - /// - /// An object that contains the event data. - [CLSCompliant(false)] - protected override void OnFragmentNavigation(FragmentNavigationEventArgs e) - { - base.OnFragmentNavigation(e); - - if (this.DataContext != null && this.DataContext is InteractionViewModelBase) - { - var vm = (InteractionViewModelBase)this.DataContext; - vm.PageState = this.State; - vm.OnFragmentNavigation(e); - } - } - - /// - /// Called just before a page is no longer the active page in a frame. - /// - /// An object that contains the event data. - protected override void OnNavigatingFrom(NavigatingCancelEventArgs e) - { - if (this.DataContext != null && this.DataContext is InteractionViewModelBase) - { - var vm = (InteractionViewModelBase)this.DataContext; - ////vm.PageState = this.State; - vm.OnNavigatingFrom(e); - } - - base.OnNavigatingFrom(e); - } - -#if !WP80 - /// - /// Called when a visual state changeis commanded from the viewmodel. - /// - /// The sender. - /// The instance containing the event data. - protected virtual void OnVisualStateChange(object sender, VisualStateChangeEventArgs e) - { - e.Succeed = VisualStateManager.GoToState(this, e.StateName, e.UseTransitions); - } -#endif - } -} diff --git a/Sources/WP7.SrkToolkit.Mvvm/Properties/AssemblyInfo.cs b/Sources/WP7.SrkToolkit.Mvvm/Properties/AssemblyInfo.cs deleted file mode 100644 index 2848a03..0000000 --- a/Sources/WP7.SrkToolkit.Mvvm/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System; - -[assembly: AssemblyTitle("SrkToolkit.Mvvm")] -[assembly: AssemblyDescription("SrkToolkit.Mvvm for WP 7.0")] - -[assembly: CLSCompliant(true)] -[assembly: Guid("12ee086f-0ba0-4af7-af68-9f845babd969")] diff --git a/Sources/WP7.SrkToolkit.Mvvm/System/DataEventArgs.cs b/Sources/WP7.SrkToolkit.Mvvm/System/DataEventArgs.cs deleted file mode 100644 index 3d4498b..0000000 --- a/Sources/WP7.SrkToolkit.Mvvm/System/DataEventArgs.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; - -namespace System { - - /// - /// Generic arguments class to pass to event handlers that need to receive data. - /// - /// - public class DataEventArgs : EventArgs { - - /// - /// Initializes the DataEventArgs class. - /// - /// - public DataEventArgs(T data) : base() { - Data = data; - } - - /// - /// Initializes the DataEventArgs class. - /// - public DataEventArgs() : base() { - - } - - /// - /// Gets the information related to the event. - /// - public T Data { get; private set; } - - } -} diff --git a/Sources/WP7.SrkToolkit.Mvvm/ViewModelBase.cs b/Sources/WP7.SrkToolkit.Mvvm/ViewModelBase.cs deleted file mode 100644 index 24b73ec..0000000 --- a/Sources/WP7.SrkToolkit.Mvvm/ViewModelBase.cs +++ /dev/null @@ -1,42 +0,0 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace SrkToolkit.Mvvm -{ - using System.ComponentModel; - using System.Diagnostics.CodeAnalysis; - using System.Windows.Threading; - using System.Windows; - - partial class ViewModelBase - { - #region Threading - - /// - /// Initializes a new instance of the class. - /// Make sure you instantiate this in the UI thread so that the dispatcher can attach. - /// - protected ViewModelBase() - { - if (Deployment.Current != null) - { - this.Dispatcher = Deployment.Current.Dispatcher; - } - } - - #endregion - } -} diff --git a/Sources/WP7.SrkToolkit.Mvvm/VisualStateChangeEventArgs.cs b/Sources/WP7.SrkToolkit.Mvvm/VisualStateChangeEventArgs.cs deleted file mode 100644 index 2facfce..0000000 --- a/Sources/WP7.SrkToolkit.Mvvm/VisualStateChangeEventArgs.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; - -namespace SrkToolkit.Mvvm { - /// - /// Used to command a visual state transition. - /// - public class VisualStateChangeEventArgs : EventArgs { - private string stateName; - private bool useTransitions; - - /// - /// Initializes a new instance of the class. - /// - /// Name of the state to reach. - /// if set to true [use transitions]. - public VisualStateChangeEventArgs(string stateName, bool useTransitions) { - this.stateName = stateName; - this.useTransitions = useTransitions; - } - - /// - /// Gets the name of the state to reach. - /// - /// - /// The name of the state to reach. - /// - public string StateName { - get { return this.stateName; } - } - - /// - /// Gets a value indicating whether [use transitions]. - /// - /// - /// true if [use transitions]; otherwise, false. - /// - public bool UseTransitions { - get { return this.useTransitions; } - } - - /// - /// Gets or sets a value indicating whether the succeed. - /// - /// - /// true if operation succeed; otherwise, false. - /// - public bool Succeed { get; set; } - } -} diff --git a/Sources/WP7.SrkToolkit.Mvvm/WP7.SrkToolkit.Mvvm.csproj b/Sources/WP7.SrkToolkit.Mvvm/WP7.SrkToolkit.Mvvm.csproj deleted file mode 100644 index 84f6dc7..0000000 --- a/Sources/WP7.SrkToolkit.Mvvm/WP7.SrkToolkit.Mvvm.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 10.0.20506 - 2.0 - {DE760EB5-95B4-4E56-89FB-48A38DDDC80A} - {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} - Library - Properties - SrkToolkit.Mvvm - SrkToolkit.Mvvm - v4.0 - $(TargetFrameworkVersion) - WindowsPhone - Silverlight - false - true - true - - - true - full - false - Bin\Debug - DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE - true - true - prompt - 4 - Bin\Debug\SrkToolkit.Mvvm.xml - true - AllRules.ruleset - - - pdbonly - true - ..\..\Binaries\WP70\ - TRACE;SILVERLIGHT;WINDOWS_PHONE - true - true - prompt - 4 - Bin\Release\SrkToolkit.Mvvm.xml - - - - - - - - - - - - SrkToolkit.Mvvm.AssemblyInfo.cs - - - InteractionViewModelBase.cs - - - Tools\BusyTask.cs - - - Tools\BusyTaskCollection.cs - - - Tools\BusyTaskType.cs - - - Tools\IMessageBoxService.cs - - - Tools\MessageBoxService.cs - - - ViewModelBase.Common.cs - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Sources/WP7.SrkToolkit.Xaml/Controls/Button.cs b/Sources/WP7.SrkToolkit.Xaml/Controls/Button.cs deleted file mode 100644 index 2582dc8..0000000 --- a/Sources/WP7.SrkToolkit.Xaml/Controls/Button.cs +++ /dev/null @@ -1,71 +0,0 @@ - -namespace SrkToolkit.Xaml.Controls -{ - using System; - using System.Net; - using System.Windows; - using System.Windows.Controls; - using System.Windows.Documents; - using System.Windows.Ink; - using System.Windows.Input; - using System.Windows.Media; - using System.Windows.Media.Animation; - using System.Windows.Shapes; - - public class Button : System.Windows.Controls.Button - { - #region Dependency property: Command - - public ICommand Command - { - get { return (ICommand)GetValue(CommandProperty); } - set { SetValue(CommandProperty, value); } - } - - public static readonly DependencyProperty CommandProperty = - DependencyProperty.Register( - "Command", - typeof(ICommand), - typeof(Button), - new PropertyMetadata(null)); - - #endregion - - #region Dependency property: CommandParameter - - public object CommandParameter - { - get { return (object)GetValue(CommandParameterProperty); } - set { SetValue(CommandParameterProperty, value); } - } - - public static readonly DependencyProperty CommandParameterProperty = - DependencyProperty.Register( - "CommandParameter", - typeof(object), - typeof(Button), - new PropertyMetadata(null)); - - #endregion - - ////public Button() - //// : base() - ////{ - ////} - - protected override void OnClick() - { - base.OnClick(); - - this.ExecuteCommand(); - } - - private void ExecuteCommand() - { - if (this.Command != null) - { - this.Command.Execute(this.CommandParameter); - } - } - } -} diff --git a/Sources/WP7.SrkToolkit.Xaml/Controls/HyperlinkButton.cs b/Sources/WP7.SrkToolkit.Xaml/Controls/HyperlinkButton.cs deleted file mode 100644 index c3c525f..0000000 --- a/Sources/WP7.SrkToolkit.Xaml/Controls/HyperlinkButton.cs +++ /dev/null @@ -1,56 +0,0 @@ - -namespace SrkToolkit.Xaml.Controls -{ - using System.Windows; - using System.Windows.Input; - - /// - /// Represents a button control that displays a hyperlink. - /// - public class HyperlinkButton : System.Windows.Controls.HyperlinkButton - { - #region Dependency property: Command - - public ICommand Command - { - get { return (ICommand)GetValue(CommandProperty); } - set { SetValue(CommandProperty, value); } - } - - public static readonly DependencyProperty CommandProperty = - DependencyProperty.Register( - "Command", - typeof(ICommand), - typeof(HyperlinkButton), - new PropertyMetadata(null)); - - #endregion - - #region Dependency property: CommandParameter - - public object CommandParameter - { - get { return (object)GetValue(CommandParameterProperty); } - set { SetValue(CommandParameterProperty, value); } - } - - public static readonly DependencyProperty CommandParameterProperty = - DependencyProperty.Register( - "CommandParameter", - typeof(object), - typeof(HyperlinkButton), - new PropertyMetadata(null)); - - #endregion - - protected override void OnClick() - { - base.OnClick(); - - if (this.Command != null) - { - this.Command.Execute(this.CommandParameter); - } - } - } -} diff --git a/Sources/WP7.SrkToolkit.Xaml/Internal/Trace.cs b/Sources/WP7.SrkToolkit.Xaml/Internal/Trace.cs deleted file mode 100644 index b69aa1c..0000000 --- a/Sources/WP7.SrkToolkit.Xaml/Internal/Trace.cs +++ /dev/null @@ -1,312 +0,0 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace SrkToolkit -{ - using System; - using System.Diagnostics; - - internal static class Trace - { - private static string Time - { - get - { - return DateTime.UtcNow.ToString("s"); - } - } - - #region Info - - /// - /// Writes an informational message. - /// - /// The message. -#if !SILVERLIGHT - [Conditional("TRACE")] -#endif - public static void TraceInfo(string message) - { -#if SILVERLIGHT - Debug.WriteLine("Information: " + Time + " " + message); -#else - Trace.TraceInformation(Time + " " + message); -#endif - } - - /// - /// Writes an informational message with an exception. - /// - /// The message. - /// The exception (can be null). -#if !SILVERLIGHT - [Conditional("TRACE")] -#endif - public static void TraceInfo(string message, Exception ex) - { - if (ex == null) - { - TraceInfo(message); - } - else - { -#if SILVERLIGHT - Debug.WriteLine("Information: " + Time + " " + message + - Environment.NewLine + ex.GetType().Name + ": " + ex.Message + - Environment.NewLine + ex.StackTrace); -#else - Trace.TraceInformation(Time + " " + message + - Environment.NewLine + ex.GetType().Name + ": " + ex.Message + - Environment.NewLine + ex.StackTrace); -#endif - } - } - - /// - /// Writes an informational message. - /// - /// Name of the object. - /// The message. -#if !SILVERLIGHT - [Conditional("TRACE")] -#endif - public static void TraceInfo(string objectName, string message) - { -#if SILVERLIGHT - Debug.WriteLine("Information: " + Time + " " + objectName + ": " + message); -#else - Trace.TraceInformation(Time + " " + objectName + ": " + message); -#endif - } - - /// - /// Writes an informational message with an exception. - /// - /// Name of the object. - /// The message. - /// The exception (can be null). -#if !SILVERLIGHT - [Conditional("TRACE")] -#endif - public static void TraceInfo(string objectName, string message, Exception ex) - { - if (ex == null) - TraceInfo(objectName, message); - else - { -#if SILVERLIGHT - Debug.WriteLine("Information: " + Time + " " + objectName + ": " + message + - Environment.NewLine + ex.GetType().Name + ": " + ex.Message + - Environment.NewLine + ex.StackTrace); -#else - Trace.TraceInformation(Time + " " + objectName + ": " + message + - Environment.NewLine + ex.GetType().Name + ": " + ex.Message); -#endif - } - } - - #endregion - - #region Warn - - /// - /// Writes a warning message. - /// - /// The message. -#if !SILVERLIGHT - [Conditional("TRACE")] -#endif - public static void TraceWarning(string message) - { -#if SILVERLIGHT - Debug.WriteLine("Warning: " + Time + " " + message); -#else - Trace.TraceWarning(Time + " " + message); -#endif - } - - /// - /// Writes a warning message with an exception. - /// - /// The message. - /// The exception (can be null). -#if !SILVERLIGHT - [Conditional("TRACE")] -#endif - public static void TraceWarning(string message, Exception ex) - { - if (ex == null) - TraceWarning(message); - else - { -#if SILVERLIGHT - Debug.WriteLine("Warning: " + Time + " " + message + - Environment.NewLine + ex.GetType().Name + ": " + ex.Message + - Environment.NewLine + ex.StackTrace); -#else - Trace.TraceWarning(Time + " " + message + - Environment.NewLine + ex.GetType().Name + ": " + ex.Message + - Environment.NewLine + ex.StackTrace); -#endif - } - } - - /// - /// Writes a warning message. - /// - /// Name of the object. - /// The message. -#if !SILVERLIGHT - [Conditional("TRACE")] -#endif - public static void TraceWarning(string objectName, string message) - { -#if SILVERLIGHT - Debug.WriteLine("Warning: " + Time + " " + objectName + ": " + message); -#else - Trace.TraceWarning(Time + " " + objectName + ": " + message); -#endif - } - - /// - /// Writes a warning message with an exception. - /// - /// Name of the object. - /// The message. - /// The exception (can be null). -#if !SILVERLIGHT - [Conditional("TRACE")] -#endif - public static void TraceWarning(string objectName, string message, Exception ex) - { - if (ex == null) - TraceWarning(objectName, message); - else - { -#if SILVERLIGHT - Debug.WriteLine("Warning: " + Time + " " + objectName + ": " + message + - Environment.NewLine + ex.GetType().Name + ": " + ex.Message + - Environment.NewLine + ex.StackTrace); -#else - Trace.TraceWarning(Time + " " + objectName + ": " + message + - Environment.NewLine + ex.GetType().Name + ": " + ex.Message); -#endif - } - } - - #endregion - - #region Error - - /// - /// Writes an error message. - /// - /// The message. -#if !SILVERLIGHT - [Conditional("TRACE")] -#endif - public static void TraceError(string message) - { -#if SILVERLIGHT - Debug.WriteLine("ERROR: " + Time + " " + message); -#else - Trace.TraceError(Time + " " + message); -#endif - } - - /// - /// Writes an error message with an exception. - /// - /// The message. - /// The exception (can be null). -#if !SILVERLIGHT - [Conditional("TRACE")] -#endif - public static void TraceError(string message, Exception ex) - { - if (ex == null) - TraceError(message); - else - { -#if SILVERLIGHT - Debug.WriteLine("ERROR: " + Time + " " + message + - Environment.NewLine + ex.GetType().Name + ": " + ex.Message + - Environment.NewLine + ex.StackTrace); -#else - Trace.TraceError(Time + " " + message + - Environment.NewLine + ex.GetType().Name + ": " + ex.Message + - Environment.NewLine + ex.StackTrace); -#endif - } - } - - /// - /// Writes an error message. - /// - /// Name of the object. - /// The message. -#if !SILVERLIGHT - [Conditional("TRACE")] -#endif - public static void TraceError(string objectName, string message) - { -#if SILVERLIGHT - Debug.WriteLine("ERROR: " + Time + " " + objectName + ": " + message); -#else - Trace.TraceError(Time + " " + objectName + ": " + message); -#endif - } - - /// - /// Writes an error message with an exception. - /// - /// Name of the object. - /// The message. - /// The exception (can be null). -#if !SILVERLIGHT - [Conditional("TRACE")] -#endif - public static void TraceError(string objectName, string message, Exception ex) - { - if (ex == null) - TraceError(objectName, message); - else - { -#if SILVERLIGHT - Debug.WriteLine("ERROR: " + Time + " " + objectName + ": " + message + - Environment.NewLine + ex.GetType().Name + ": " + ex.Message + - Environment.NewLine + ex.StackTrace); -#else - Trace.TraceError(Time + " " + objectName + ": " + message + - Environment.NewLine + ex.GetType().Name + ": " + ex.Message); -#endif - } - } - - #endregion - -#if !SILVERLIGHT - /// - /// Flushes the output buffer. - /// - [Conditional("TRACE")] - public static void Flush() - { - Trace.Flush(); - } -#endif - } -} diff --git a/Sources/WP7.SrkToolkit.Xaml/Properties/AssemblyInfo.cs b/Sources/WP7.SrkToolkit.Xaml/Properties/AssemblyInfo.cs deleted file mode 100644 index 7075ecf..0000000 --- a/Sources/WP7.SrkToolkit.Xaml/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System; -using System.Resources; - -[assembly: AssemblyTitle("SrkToolkit.Xaml")] -[assembly: AssemblyDescription("SrkToolkit.Xaml for WP 7.0")] - -[assembly: CLSCompliant(true)] -[assembly: Guid("0a1025cf-1127-420e-849b-d4314487ddf9")] - -[assembly: NeutralResourcesLanguageAttribute("en-US")] - diff --git a/Sources/WP7.SrkToolkit.Xaml/WP7.SrkToolkit.Xaml.csproj b/Sources/WP7.SrkToolkit.Xaml/WP7.SrkToolkit.Xaml.csproj deleted file mode 100644 index 002553b..0000000 --- a/Sources/WP7.SrkToolkit.Xaml/WP7.SrkToolkit.Xaml.csproj +++ /dev/null @@ -1,89 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {42516A13-035C-48F7-A8DB-35681BF7117C} - {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} - Library - Properties - SrkToolkit.Xaml - SrkToolkit.Xaml - v4.0 - $(TargetFrameworkVersion) - WindowsPhone - Silverlight - false - true - true - - - true - full - false - bin\Debug\ - DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE - prompt - 4 - - - pdbonly - true - ..\..\Binaries\WP70\ - TRACE;SILVERLIGHT;WINDOWS_PHONE - prompt - 4 - ..\..\Binaries\WP70\SrkToolkit.Xaml.xml - - - - - - - - ..\Libs-WP70\System.Windows.Interactivity.dll - - - - - - - Behaviors\InputEnterBehavior.cs - - - Behaviors\ListBoxScrollBehavior.cs - - - Extensions\DependencyObjectExtensions.cs - - - SrkToolkit.Xaml.AssemblyInfo.cs - - - Converters\BoolToVisibilityConverter.cs - - - Converters\DateTimeDateConverter.cs - - - Converters\NotNullToVisibilityConverter.cs - - - Converters\OppositeBoolConverter.cs - - - Converters\ToLowerConverter.cs - - - Converters\ToUpperConverter.cs - - - - - - - - - \ No newline at end of file diff --git a/Sources/WP71.SrkToolkit.Mvvm/Properties/AssemblyInfo.cs b/Sources/WP71.SrkToolkit.Mvvm/Properties/AssemblyInfo.cs deleted file mode 100644 index 577ff51..0000000 --- a/Sources/WP71.SrkToolkit.Mvvm/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System; - -[assembly: AssemblyTitle("SrkToolkit.Mvvm")] -[assembly: AssemblyDescription("SrkToolkit.Mvvm for WP 7.1")] - -[assembly: CLSCompliant(true)] -[assembly: Guid("12ee086f-0ba0-4af7-af68-9f845babd96a")] diff --git a/Sources/WP71.SrkToolkit.Mvvm/WP71.SrkToolkit.Mvvm.csproj b/Sources/WP71.SrkToolkit.Mvvm/WP71.SrkToolkit.Mvvm.csproj deleted file mode 100644 index 10be4d6..0000000 --- a/Sources/WP71.SrkToolkit.Mvvm/WP71.SrkToolkit.Mvvm.csproj +++ /dev/null @@ -1,110 +0,0 @@ - - - - Debug - AnyCPU - 10.0.20506 - 2.0 - {011FCD78-30C5-42BC-9499-AA4B4CDD7897} - {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} - Library - Properties - SrkToolkit.Mvvm - SrkToolkit.Mvvm - v4.0 - $(TargetFrameworkVersion) - WindowsPhone71 - Silverlight - false - true - true - - - true - full - false - Bin\Debug - DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE - true - true - prompt - 4 - Bin\Debug\SrkToolkit.Mvvm.xml - true - AllRules.ruleset - - - pdbonly - true - ..\..\Binaries\WP71\ - TRACE;SILVERLIGHT;WINDOWS_PHONE;MANGO - true - true - prompt - 4 - ..\..\Binaries\WP71\SrkToolkit.Mvvm.xml - - - - - - - - - - - - SrkToolkit.Mvvm.AssemblyInfo.cs - - - Commands\RelayCommand.cs - - - Commands\RelayCommand.T.cs - - - GlobalSuppressions.cs - - - InteractionViewModelBase.WP7.cs - - - PhoneApplicationPage.cs - - - System\DataEventArgs.cs - - - ViewModelBase.cs - - - VisualStateChangeEventArgs.cs - - - InteractionViewModelBase.cs - - - Tools\BusyTask.cs - - - Tools\BusyTaskCollection.cs - - - Tools\BusyTaskType.cs - - - Tools\IMessageBoxService.cs - - - Tools\MessageBoxService.cs - - - ViewModelBase.Common.cs - - - - - - - - \ No newline at end of file diff --git a/Sources/WP71.SrkToolkit.Xaml/Properties/AssemblyInfo.cs b/Sources/WP71.SrkToolkit.Xaml/Properties/AssemblyInfo.cs deleted file mode 100644 index ef600e8..0000000 --- a/Sources/WP71.SrkToolkit.Xaml/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Resources; -using System; - -[assembly: AssemblyTitle("SrkToolkit.Xaml")] -[assembly: AssemblyDescription("SrkToolkit.Xaml for WP 7.1")] - -[assembly: CLSCompliant(true)] -[assembly: Guid("567f0a0b-6cc5-46ac-b71e-74896b07784e")] - -[assembly: NeutralResourcesLanguageAttribute("en-US")] diff --git a/Sources/WP71.SrkToolkit.Xaml/WP71.SrkToolkit.Xaml.csproj b/Sources/WP71.SrkToolkit.Xaml/WP71.SrkToolkit.Xaml.csproj deleted file mode 100644 index 6806e8c..0000000 --- a/Sources/WP71.SrkToolkit.Xaml/WP71.SrkToolkit.Xaml.csproj +++ /dev/null @@ -1,98 +0,0 @@ - - - - Debug - AnyCPU - 10.0.20506 - 2.0 - {D3B7AB5F-493E-495E-8853-3E4454AFA794} - {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} - Library - Properties - SrkToolkit.Xaml - SrkToolkit.Xaml - v4.0 - $(TargetFrameworkVersion) - WindowsPhone71 - Silverlight - false - true - true - - - true - full - false - Bin\Debug - DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE - true - true - prompt - 4 - - - pdbonly - true - ..\..\Binaries\WP71\ - TRACE;SILVERLIGHT;WINDOWS_PHONE - true - true - prompt - 4 - ..\..\Binaries\WP71\SrkToolkit.Xaml.xml - - - - - - - ..\Libs-WP71\System.Windows.Interactivity.dll - - - - - - - - Behaviors\InputEnterBehavior.cs - - - Behaviors\ListBoxScrollBehavior.cs - - - Extensions\DependencyObjectExtensions.cs - - - SrkToolkit.Xaml.AssemblyInfo.cs - - - Controls\Button.cs - - - Internal\Trace.cs - - - Converters\BoolToVisibilityConverter.cs - - - Converters\DateTimeDateConverter.cs - - - Converters\NotNullToVisibilityConverter.cs - - - Converters\OppositeBoolConverter.cs - - - Converters\ToLowerConverter.cs - - - Converters\ToUpperConverter.cs - - - - - - - - \ No newline at end of file diff --git a/Sources/WP80.SrkToolkit.Mvvm/Properties/AssemblyInfo.cs b/Sources/WP80.SrkToolkit.Mvvm/Properties/AssemblyInfo.cs deleted file mode 100644 index 5fe30c6..0000000 --- a/Sources/WP80.SrkToolkit.Mvvm/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Resources; -using System; - -[assembly: AssemblyTitle("WP80.SrkToolkit.Mvvm")] -[assembly: AssemblyDescription("SrkToolkit.Mvvm for Windows Phone 8.0")] - -[assembly: CLSCompliant(true)] -[assembly: Guid("96157daf-8360-43bb-89c8-cdaf29acbb68")] - diff --git a/Sources/WP80.SrkToolkit.Mvvm/WP80.SrkToolkit.Mvvm.csproj b/Sources/WP80.SrkToolkit.Mvvm/WP80.SrkToolkit.Mvvm.csproj deleted file mode 100644 index 27189bc..0000000 --- a/Sources/WP80.SrkToolkit.Mvvm/WP80.SrkToolkit.Mvvm.csproj +++ /dev/null @@ -1,137 +0,0 @@ - - - - Debug - AnyCPU - 10.0.20506 - 2.0 - {96157DAF-8360-43BB-89C8-CDAF29ACBB68} - {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} - Library - Properties - SrkToolkit.Mvvm - SrkToolkit.Mvvm - WindowsPhone - v8.0 - $(TargetFrameworkVersion) - false - true - 11.0 - true - - - true - full - false - Bin\Debug - TRACE;DEBUG;SILVERLIGHT;WINDOWS_PHONE;WP80 - true - true - prompt - 4 - Bin\Debug\SrkToolkit.Mvvm.xml - - - pdbonly - true - Bin\Release - TRACE;SILVERLIGHT;WINDOWS_PHONE - true - true - prompt - 4 - - - true - full - false - Bin\x86\Debug - DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE - true - true - prompt - 4 - - - pdbonly - true - Bin\x86\Release - TRACE;SILVERLIGHT;WINDOWS_PHONE - true - true - prompt - 4 - - - true - full - false - Bin\ARM\Debug - DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE - true - true - prompt - 4 - - - pdbonly - true - Bin\ARM\Release - TRACE;SILVERLIGHT;WINDOWS_PHONE - true - true - prompt - 4 - - - - Properties\SrkToolkit.Mvvm.AssemblyInfo.cs - - - Commands\RelayCommand.cs - - - Commands\RelayCommand.T.cs - - - InteractionViewModelBase.WP7.cs - - - PhoneApplicationPage.cs - - - PhoneAppNavigationState.cs - - - PhoneAppService.cs - - - ViewModelBase.cs - - - InteractionViewModelBase.cs - - - Tools\BusyTask.cs - - - Tools\BusyTaskCollection.cs - - - Tools\BusyTaskType.cs - - - Tools\IMessageBoxService.cs - - - Tools\MessageBoxService.cs - - - ViewModelBase.Common.cs - - - - - - - \ No newline at end of file diff --git a/Sources/WP80.SrkToolkit.Xaml/Controls/DataTemplateSelector.cs b/Sources/WP80.SrkToolkit.Xaml/Controls/DataTemplateSelector.cs deleted file mode 100644 index 88f7904..0000000 --- a/Sources/WP80.SrkToolkit.Xaml/Controls/DataTemplateSelector.cs +++ /dev/null @@ -1,27 +0,0 @@ - -namespace SrkToolkit.Xaml.Controls -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Windows; - using System.Windows.Controls; - - /// - /// A base class to select data template based upon 'some' criterium - /// Taken from http://www.windowsphonegeek.com/articles/Implementing-Windows-Phone-7-DataTemplateSelector-and-CustomDataTemplateSelector - /// - public abstract class DataTemplateSelector : ContentControl - { - public virtual DataTemplate SelectTemplate(object item, DependencyObject container) - { - return null; - } - - protected override void OnContentChanged(object oldContent, object newContent) - { - base.OnContentChanged(oldContent, newContent); - this.ContentTemplate = this.SelectTemplate(newContent, this); - } - } -} diff --git a/Sources/WP80.SrkToolkit.Xaml/Properties/AssemblyInfo.cs b/Sources/WP80.SrkToolkit.Xaml/Properties/AssemblyInfo.cs deleted file mode 100644 index e6f64de..0000000 --- a/Sources/WP80.SrkToolkit.Xaml/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Resources; - -[assembly: AssemblyTitle("WP80.SrkToolkit.Xaml")] -[assembly: AssemblyDescription("SrkToolkit.Xaml for Windows Phone 8.0")] - -[assembly: Guid("7c9f4236-bf1f-4c92-ab4e-b41c4271e359")] diff --git a/Sources/WPF4.SrkToolkit.Mvvm/Commands/RelayCommand.T.cs b/Sources/WPF4.SrkToolkit.Mvvm/Commands/RelayCommand.T.cs deleted file mode 100644 index 7cae748..0000000 --- a/Sources/WPF4.SrkToolkit.Mvvm/Commands/RelayCommand.T.cs +++ /dev/null @@ -1,129 +0,0 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace SrkToolkit.Mvvm.Commands -{ - using System; - using System.Windows.Input; - using System.Diagnostics; - - /// - /// Classic generic RelayCommand implementation for the MVVM pattern. - /// - public class RelayCommand : ICommand - { - private readonly Predicate canExecuteFunc; - private readonly Action executeAction; - private readonly bool canExecutePreventsExecute; - -#if SILVERLIGHT || WPF - /// - /// Occurs when changes occur that affect whether or not the command should execute. - /// - public event EventHandler CanExecuteChanged - { - add - { - if (this.canExecuteFunc != null) - { - CommandManager.RequerySuggested += value; - } - } - remove - { - if (this.canExecuteFunc != null) - { - CommandManager.RequerySuggested -= value; - } - } - } -#elif UWP - /// - /// Occurs when changes occur that affect whether or not the command should execute. - /// - public event EventHandler CanExecuteChanged; -#endif - - /// - /// Create a new instance that can always execute. - /// - /// the action to execute - /// If the execute argument is null. - [DebuggerStepThrough] - public RelayCommand(Action execute) - : this(execute, null, false) - { - } - - /// - /// Initializes a new instance of the RelayCommand class. - /// - /// The execution logic. - /// The execution status logic. - /// if set to true the canExecute predicate prevents execution. - /// If the execute argument is null. - [DebuggerStepThrough] - public RelayCommand(Action execute, Predicate canExecute, bool canExecutePreventsExecute) - { - if (execute == null) - { - throw new ArgumentNullException("execute"); - } - this.executeAction = execute; - this.canExecuteFunc = canExecute; - this.canExecutePreventsExecute = canExecutePreventsExecute; - } - - /// - /// Defines the method that determines whether the command can execute in its current state. - /// - /// This parameter will always be ignored. - /// true if this command can be executed; otherwise, false. - [DebuggerStepThrough] - public bool CanExecute(object parameter) - { - return ((this.canExecuteFunc == null) ? true : this.canExecuteFunc.Invoke((T)parameter)); - } - - /// - /// Defines the method to be called when the command is invoked. - /// - /// This parameter will always be ignored. - [DebuggerStepThrough] - public void Execute(object parameter) - { - if (this.canExecutePreventsExecute && this.canExecuteFunc != null) - { - if (this.canExecuteFunc((T)parameter)) - this.executeAction.Invoke((T)parameter); - } - else - { - this.executeAction.Invoke((T)parameter); - } - } - - /// - /// Raises the event. - /// - public void RaiseCanExecuteChanged() - { -#if SILVERLIGHT || WPF - CommandManager.InvalidateRequerySuggested(); -#endif - } - } -} diff --git a/Sources/WPF4.SrkToolkit.Mvvm/Commands/RelayCommand.cs b/Sources/WPF4.SrkToolkit.Mvvm/Commands/RelayCommand.cs deleted file mode 100644 index 1c63964..0000000 --- a/Sources/WPF4.SrkToolkit.Mvvm/Commands/RelayCommand.cs +++ /dev/null @@ -1,129 +0,0 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace SrkToolkit.Mvvm.Commands -{ - using System; - using System.Windows.Input; - using System.Diagnostics; - - /// - /// Classic RelayCommand implementation for the MVVM pattern. - /// - public class RelayCommand : ICommand - { - private readonly Func canExecuteFunc; - private readonly Action executeAction; - private readonly bool canExecutePreventsExecute; - -#if SILVERLIGHT || WPF - /// - /// Occurs when changes occur that affect whether or not the command should execute. - /// - public event EventHandler CanExecuteChanged - { - add - { - if (this.canExecuteFunc != null) - { - CommandManager.RequerySuggested += value; - } - } - remove - { - if (this.canExecuteFunc != null) - { - CommandManager.RequerySuggested -= value; - } - } - } -#elif UWP - /// - /// Occurs when changes occur that affect whether or not the command should execute. - /// - public event EventHandler CanExecuteChanged; -#endif - - /// - /// Create a new instance that can always execute. - /// - /// the action to execute - /// If the execute argument is null. - [DebuggerStepThrough] - public RelayCommand(Action execute) - : this(execute, null, false) - { - } - - /// - /// Initializes a new instance of the RelayCommand class. - /// - /// The execution logic. - /// The execution status logic. - /// if set to true the canExecute predicate prevents execution. - /// If the execute argument is null. - [DebuggerStepThrough] - public RelayCommand(Action execute, Func canExecute, bool canExecutePreventsExecute) - { - if (execute == null) - { - throw new ArgumentNullException("execute"); - } - this.executeAction = execute; - this.canExecuteFunc = canExecute; - this.canExecutePreventsExecute = canExecutePreventsExecute; - } - - /// - /// Defines the method that determines whether the command can execute in its current state. - /// - /// This parameter will always be ignored. - /// true if this command can be executed; otherwise, false. - [DebuggerStepThrough] - public bool CanExecute(object parameter) - { - return ((this.canExecuteFunc == null) ? true : this.canExecuteFunc.Invoke()); - } - - /// - /// Defines the method to be called when the command is invoked. - /// - /// This parameter will always be ignored. - [DebuggerStepThrough] - public void Execute(object parameter) - { - if (this.canExecutePreventsExecute && this.canExecuteFunc != null) - { - if (this.canExecuteFunc()) - this.executeAction.Invoke(); - } - else - { - this.executeAction.Invoke(); - } - } - - /// - /// Raises the event. - /// - public void RaiseCanExecuteChanged() - { -#if SILVERLIGHT || WPF - CommandManager.InvalidateRequerySuggested(); -#endif - } - } -} diff --git a/Sources/WPF4.SrkToolkit.Mvvm/DispatcherExtensions.cs b/Sources/WPF4.SrkToolkit.Mvvm/DispatcherExtensions.cs deleted file mode 100644 index 654035b..0000000 --- a/Sources/WPF4.SrkToolkit.Mvvm/DispatcherExtensions.cs +++ /dev/null @@ -1,60 +0,0 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace System.Windows.Threading -{ - using System.Windows.Threading; - - /// - /// Extension methods for the class. - /// - public static class DispatcherExtensions - { - /// - /// Executes the specified delegate asynchronously on the thread that the was created on. - /// - /// The dispatcher. - /// The action. - public static void BeginInvoke(this Dispatcher dispatcher, Action action) - { - dispatcher.BeginInvoke(action); - } - - /// - /// Executes the specified delegate asynchronously on the thread that the was created on. - /// - public static void BeginInvoke(this Dispatcher dispatcher, Action action, DispatcherPriority priority) - { - dispatcher.BeginInvoke(action, priority); - } - - /// - /// Executes the specified delegate synchronously on the thread that the was created on. - /// - public static void Invoke(this Dispatcher dispatcher, Action action) - { - dispatcher.Invoke(action); - } - - /// - /// Executes the specified delegate synchronously on the thread that the was created on. - /// - public static void Invoke(this Dispatcher dispatcher, Action action, DispatcherPriority priority) - { - dispatcher.Invoke(action, priority); - } - } -} diff --git a/Sources/WPF4.SrkToolkit.Mvvm/GlobalSuppressions.cs b/Sources/WPF4.SrkToolkit.Mvvm/GlobalSuppressions.cs deleted file mode 100644 index e065f9d..0000000 --- a/Sources/WPF4.SrkToolkit.Mvvm/GlobalSuppressions.cs +++ /dev/null @@ -1,32 +0,0 @@ -// This file is used by Code Analysis to maintain SuppressMessage -// attributes that are applied to this project. -// Project-level suppressions either have no target or are given -// a specific target and scoped to a namespace, type, member, etc. -// -// To add a suppression to this file, right-click the message in the -// Error List, point to "Suppress Message(s)", and click -// "In Project Suppression File". -// You do not need to add suppressions to this file manually. - -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed", Scope = "member", Target = "SrkToolkit.Mvvm.InteractionViewModelBase.#UpdateTask(System.String,System.Boolean,System.String,SrkToolkit.Mvvm.Tools.BusyTaskType)")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed", Scope = "member", Target = "SrkToolkit.Mvvm.InteractionViewModelBase.#UpdateTask(System.String,System.Exception,System.String,System.Boolean,SrkToolkit.Mvvm.Tools.BusyTaskType)")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed", Scope = "member", Target = "SrkToolkit.Mvvm.InteractionViewModelBase.#UpdateTask(System.String,System.String,System.Boolean,SrkToolkit.Mvvm.Tools.BusyTaskType)")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1030:UseEventsWhereAppropriate", Scope = "member", Target = "SrkToolkit.Mvvm.Commands.RelayCommand.#RaiseCanExecuteChanged()")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1030:UseEventsWhereAppropriate", Scope = "member", Target = "SrkToolkit.Mvvm.Commands.RelayCommand`1.#RaiseCanExecuteChanged()")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1043:UseIntegralOrStringArgumentForIndexers", Scope = "member", Target = "SrkToolkit.Mvvm.Tools.BusyTaskCollection.#Item[System.Enum]")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1045:DoNotPassTypesByReference", MessageId = "0#", Scope = "member", Target = "SrkToolkit.Mvvm.ViewModelBase.#SetValue`1(!!0&,!!0,System.String)")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "SrkToolkit.Mvvm.Tools.BusyTaskCollection.#Add(System.Enum,System.Boolean)")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "1", Scope = "member", Target = "SrkToolkit.Mvvm.Tools.BusyTaskCollection.#InsertItem(System.Int32,SrkToolkit.Mvvm.Tools.BusyTask)")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "SrkToolkit.Mvvm.Tools.BusyTaskCollection.#Item[System.Enum]")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Mbox", Scope = "member", Target = "SrkToolkit.Mvvm.InteractionViewModelBase.#Mbox")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Mvvm")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Mvvm", Scope = "namespace", Target = "SrkToolkit.Mvvm")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Mvvm", Scope = "namespace", Target = "SrkToolkit.Mvvm.Commands")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Mvvm", Scope = "namespace", Target = "SrkToolkit.Mvvm.Tools")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Srk")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Srk", Scope = "namespace", Target = "SrkToolkit.Base")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Srk", Scope = "namespace", Target = "SrkToolkit.Mvvm")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Srk", Scope = "namespace", Target = "SrkToolkit.Mvvm.Commands")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Srk", Scope = "namespace", Target = "SrkToolkit.Mvvm.Tools")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods", Scope = "member", Target = "SrkToolkit.Mvvm.Tools.BusyTask.#Type")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline", Scope = "member", Target = "SrkToolkit.Mvvm.ViewModelBase.#.cctor()")] diff --git a/Sources/WPF4.SrkToolkit.Mvvm/InteractionViewModelBase.cs b/Sources/WPF4.SrkToolkit.Mvvm/InteractionViewModelBase.cs deleted file mode 100644 index 820b036..0000000 --- a/Sources/WPF4.SrkToolkit.Mvvm/InteractionViewModelBase.cs +++ /dev/null @@ -1,204 +0,0 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace SrkToolkit.Mvvm -{ - using System; - using SrkToolkit.Mvvm.Tools; - - /// - /// Higher-level ViewModel base with tasks and MessageBox abstraction. - /// - public partial class InteractionViewModelBase : ViewModelBase - { - private readonly BusyTaskCollection tasks = new BusyTaskCollection(); - private InteractionViewModelBase baseViewModel; -#if SILVERLIGHT || WPF - private IMessageBoxService mbox; -#endif - - /// - /// Initializes a new instance of the class. - /// Make sure you instantiate this in the UI thread so that the dispatcher can attach. - /// - public InteractionViewModelBase() - : base() - { - } - - /// - /// Initializes a new instance of the class. - /// Make sure you instantiate this in the UI thread so that the dispatcher can attach. - /// - public InteractionViewModelBase(InteractionViewModelBase interactionViewModelBase) - : base() - { - this.baseViewModel = interactionViewModelBase; - } - - /// - /// This collection contains tasks that are being processed. - /// Nice properties are Tasks.IsBusy and Tasks.IsProcessing. - /// Access tasks from the view with - /// - {Binding Tasks[AutoLogin].IsProcessing} - /// - {Binding Tasks[AutoLogin].Message} - /// - public BusyTaskCollection Tasks - { - get { return tasks; } - } - -#if SILVERLIGHT || WPF - /// - /// MessageBox abstraction. - /// You can replace this for unit-testing. - /// - protected IMessageBoxService Mbox - { - get { return mbox ?? (mbox = new MessageBoxService()); } - set { mbox = value; } - } -#endif - - /// - /// Initialize a task. - /// - /// - /// - protected BusyTask CreateTask(string key, bool isGlobal) - { - var task = Tasks[key]; - if (task != null) - { - throw new ArgumentException("a task with this key already exists", "key"); - } - else - { - task = new BusyTask - { - IsGlobal = isGlobal, - Key = key, - }; - this.Tasks.Add(task); - return task; - } - } - - /// - /// Initialize a task. - /// - /// - /// - /// the display name - protected BusyTask CreateTask(string key, bool isGlobal, string name) - { - var task = Tasks[key]; - if (task != null) - { - throw new ArgumentException("a task with this key already exists", "key"); - } - else - { - task = new BusyTask - { - IsGlobal = isGlobal, - Key = key, - Name = name, - }; - this.Tasks.Add(task); - return task; - } - } - - /// - /// Update a task status. - /// - /// - /// - /// - /// - protected void UpdateTask(string key, bool isProcessing = false, string message = null, BusyTaskType type = BusyTaskType.Default) - { - var task = this.Tasks[key]; - if (task != null) - { - this.Tasks.Update(key, message, isProcessing, type); - } - else - { - task = new BusyTask - { - Key = key, - IsGlobal = false, - IsProcessing = isProcessing, - Message = message, - }; - this.Tasks.Add(task); - } - } - - /// - /// Update a task status. - /// - /// - /// - /// - /// - protected void UpdateTask(string key, string message = null, bool isProcessing = false, BusyTaskType type = BusyTaskType.Default) - { - var task = Tasks[key]; - if (task != null) - { - Tasks.Update(key, message, isProcessing, type); - } - else - { - task = new BusyTask - { - Key = key, - IsGlobal = false, - IsProcessing = isProcessing, - Message = message, - }; - Tasks.Add(task); - } - } - - /// - /// Update a task status with an exception message. - /// - /// The key. - /// The exception. - /// The message. - /// if set to true [is processing]. - /// The type. - protected void UpdateTask(string key, Exception exception, string message = null, bool isProcessing = false, BusyTaskType type = BusyTaskType.Error) - { - if (exception != null) - { -#if DEBUG - UpdateTask(key, isProcessing, message ?? exception.Message, type); -#else - UpdateTask(key, isProcessing, message ?? "An error occured. ", type); -#endif - } - else - { - UpdateTask(key, isProcessing, message, BusyTaskType.Default); - } - } - } -} diff --git a/Sources/WPF4.SrkToolkit.Mvvm/Properties/AssemblyInfo.cs b/Sources/WPF4.SrkToolkit.Mvvm/Properties/AssemblyInfo.cs deleted file mode 100644 index b836e72..0000000 --- a/Sources/WPF4.SrkToolkit.Mvvm/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; -using System; -using System.Runtime.CompilerServices; - -[assembly: AssemblyTitle("SrkToolkit.Mvvm for WPF4")] -[assembly: AssemblyDescription("SrkToolkit.Mvvm for WPF4")] - -[assembly: CLSCompliant(true)] -[assembly: Guid("38fef4bf-4c9d-4aed-85a8-71e31fe377ad")] - -[assembly: InternalsVisibleTo("SrkToolkit.Mvvm.Tests, PublicKeyToken=002400000480000094000000060200000024000052534131000400000100010077f1652580ffa2d56ce4dc68d05f1a28417937d76f2b9f03308abd09826c6782117e9c64420c359b8ca6dc9bac3820264248324316f538822b1b3039cafa8110e6a097b1ccfb30603f640278256193fd83093aa3230ce7bb329372b2883cda3e6131391467eb5e63debf8bcea1f0b6fc991af6960b3d75bd496ca4155dd644b8")] diff --git a/Sources/WPF4.SrkToolkit.Mvvm/System/DataEventArgs.cs b/Sources/WPF4.SrkToolkit.Mvvm/System/DataEventArgs.cs deleted file mode 100644 index b8e2a5a..0000000 --- a/Sources/WPF4.SrkToolkit.Mvvm/System/DataEventArgs.cs +++ /dev/null @@ -1,51 +0,0 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace System -{ - using System; - - /// - /// Generic arguments class to pass to event handlers that need to receive data. - /// - /// - public class DataEventArgs : EventArgs - { - /// - /// Initializes the DataEventArgs class. - /// - /// - public DataEventArgs(T data) - : base() - { - Data = data; - } - - /// - /// Initializes the DataEventArgs class. - /// - public DataEventArgs() - : base() - { - - } - - /// - /// Gets the information related to the event. - /// - public T Data { get; private set; } - } -} diff --git a/Sources/WPF4.SrkToolkit.Mvvm/Tools/BusyTask.cs b/Sources/WPF4.SrkToolkit.Mvvm/Tools/BusyTask.cs deleted file mode 100644 index aff113c..0000000 --- a/Sources/WPF4.SrkToolkit.Mvvm/Tools/BusyTask.cs +++ /dev/null @@ -1,183 +0,0 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace SrkToolkit.Mvvm.Tools -{ - using System; - using SrkToolkit.Mvvm; - - /// - /// Represent a background task in a viewmodel. - /// - public class BusyTask : ViewModelBase - { - private bool _isProcessing; - private string _message; - private BusyTaskType _type; - - /// - /// Contains a description. - /// Use the property instead. - /// - private string description; - - /// - /// Contains the display name. - /// Use the property instead. - /// - private string name; - - /// - /// Initializes a new instance of the class. - /// - public BusyTask() - { - } - - /// - /// Initializes a new instance of the class. - /// - /// The key. - public BusyTask(string key) - { - this.Key = key; - } - - /// - /// Message to display like "Downloading data... ". - /// - public string Message - { - get { return this._message; } - set { this.SetValue(ref this._message, value, "Message"); } - } - - /// - /// Gets or sets a description. - /// Not used by the BusyTask framework. - /// - public string Description - { - get { return this.description; } - set { this.SetValue(ref this.description, value, "Description"); } - } - - /// - /// Gets or sets the display name. - /// - public string Name - { - get { return this.name; } - set { this.SetValue(ref this.name, value, "Name"); } - } - - /// - /// Gets or sets a value indicating whether the task currently processing. - /// Will set to false. - /// - /// - /// true if the task currently processing; otherwise, false. - /// - public bool IsProcessing - { - get { return this._isProcessing; } - set - { - if (this.SetValue(ref this._isProcessing, value, "IsProcessing")) - { - this.RaisePropertyChanged("IsNotProcessing"); - } - this.IsQueued = false; - } - } - - /// - /// Gets a value indicating whether the task not currently processing. - /// Will set to false. - /// - /// - /// true if the task not currently processing; otherwise, false. - /// - public bool IsNotProcessing - { - get { return !this._isProcessing; } - } - - /// - /// Gets or sets a informative value indicating whether this task is queued for execution. - /// Not used by the BusyTask framework. - /// - /// - /// true if this task is queued for execution; otherwise, false. - /// - public bool IsQueued { get; set; } - - /// - /// Gets or sets the queued action. - /// Not used by the BusyTask framework. - /// - /// - /// The queued action. - /// - public Action QueuedAction { get; set; } - - /// - /// Optionnal task type. - /// Permit to display a red/green message. - /// - public BusyTaskType Type - { - get { return this._type; } - set - { - if (this._type != value) - { - this._type = value; - this.RaisePropertyChanged("Type"); - this.RaisePropertyChanged("IsError"); - this.RaisePropertyChanged("IsConfirmation"); - } - } - } - - /// - /// Simple accessor linked to . - /// - public bool IsError - { - get { return this._type == BusyTaskType.Error; } - } - - /// - /// Simple accessor linked to . - /// - public bool IsConfirmation - { - get { return this._type == BusyTaskType.Confirmation; } - } - - /// - /// Unique key. - /// - public string Key { get; set; } - - /// - /// If both and , - /// permits to freeze the UI with . - /// - public bool IsGlobal { get; set; } - } -} diff --git a/Sources/WPF4.SrkToolkit.Mvvm/Tools/BusyTaskCollection.cs b/Sources/WPF4.SrkToolkit.Mvvm/Tools/BusyTaskCollection.cs deleted file mode 100644 index 925f36f..0000000 --- a/Sources/WPF4.SrkToolkit.Mvvm/Tools/BusyTaskCollection.cs +++ /dev/null @@ -1,273 +0,0 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace SrkToolkit.Mvvm.Tools -{ - using System.Collections.ObjectModel; - using System.ComponentModel; - using System.Linq; - using System; - - /// - /// Represent background tasks in a viewmodel. - /// - public class BusyTaskCollection : ObservableCollection - { - #region Private fields - - private bool _isBusy; - private bool _isProcessing; - - #endregion - - #region Public properties - - /// - /// Permits to disable the whole UI for a blocking task. - /// - public bool IsBusy - { - get { return this._isBusy; } - set - { - if (this._isBusy != value) - { - this._isBusy = value; - this.OnPropertyChanged(new PropertyChangedEventArgs("IsBusy")); - this.OnPropertyChanged(new PropertyChangedEventArgs("IsNotBusy")); - } - } - } - - /// - /// Permits to disable the whole UI for a blocking task. - /// - public bool IsNotBusy { get { return !_isBusy; } } - - /// - /// Permits to show the user a background task is performing. - /// - public bool IsProcessing - { - get { return this._isProcessing; } - set - { - if (this._isProcessing != value) - { - this._isProcessing = value; - this.OnPropertyChanged(new PropertyChangedEventArgs("IsProcessing")); - this.OnPropertyChanged(new PropertyChangedEventArgs("IsNotProcessing")); - } - } - } - - /// - /// Permits to show the user a background task is performing. - /// - public bool IsNotProcessing { get { return !this._isProcessing; } } - - /// - /// Get a task by key. - /// - /// - /// - public BusyTask this[Enum key] - { - get - { - return this[key.ToString()]; - } - } - - /// - /// Get a task by key. - /// - /// - /// - public BusyTask this[string key] - { - get - { - return this.FirstOrDefault(i => i.Key == key); - } - } - - /// - /// Message aggreagated form all tasks currently busy. - /// - public string AggregateMessage - { - get - { - var message = string.Empty; - string sep = string.Empty; - foreach (var item in this) - { - if (!string.IsNullOrEmpty(item.Message)) - { - message += sep + item.Message; - sep = Environment.NewLine; - } - } - return string.IsNullOrEmpty(message) ? null : message.Trim(); - } - } - - #endregion - - #region .ctor - - /// - /// Initializes a new instance of the class. - /// - public BusyTaskCollection() - : base() - { - } - - #endregion - - /// - /// Occurs when a task state changed. - /// - public event EventHandler StateChangedEvent; - - #region Public methods - - /// - /// Create a task. - /// - /// - /// pass true to freeze the UI when processing - public void Add(string key, bool isGlobal) - { - this.Add(new BusyTask - { - Key = key, - IsGlobal = isGlobal - }); - } - - /// - /// Create a task. - /// - /// The task key. - /// pass true to freeze the UI when processing - public void Add(Enum key, bool isGlobal) - { - this.Add(key.ToString(), isGlobal); - } - - /// - /// Updates the specified key. - /// - /// The task key. - /// The message. - /// if set to true [is processing]. - /// The type. - public void Update(string key, string message, bool isProcessing, BusyTaskType type) - { - var task = this[key]; - task.Message = message; - task.IsProcessing = isProcessing; - task.Type = type; - this.OnPropertyChanged(new PropertyChangedEventArgs("AggregateMessage")); - } - - #endregion - - #region Overrides - - /// - /// Inserts the item. - /// - /// The index. - /// The item. - protected override void InsertItem(int index, BusyTask item) - { - base.InsertItem(index, item); - - item.PropertyChanged += OnItemPropertyChanged; - - this.ComputeStatus(); - } - - /// - /// Removes the item. - /// - /// The index. - protected override void RemoveItem(int index) - { - if (this[index] != null) - this[index].PropertyChanged -= OnItemPropertyChanged; - - base.RemoveItem(index); - - this.ComputeStatus(); - } - - /// - /// Clears the items. - /// - protected override void ClearItems() - { - foreach (var item in this) - { - item.PropertyChanged -= OnItemPropertyChanged; - } - - base.ClearItems(); - - this.ComputeStatus(); - } - - #endregion - - #region Internal stuff - - private void OnItemPropertyChanged(object sender, PropertyChangedEventArgs e) - { - var item = sender as BusyTask; - - if (item != null && e.PropertyName == "IsProcessing") - { - this.ComputeStatus(); - } - } - - private void ComputeStatus() - { - bool isbusy = false; - bool isprocessing = false; - - foreach (var item in this) - { - isprocessing |= item.IsProcessing; - isbusy |= item.IsGlobal && item.IsProcessing; - } - - this.IsBusy = isbusy; - this.IsProcessing = isprocessing; - this.OnPropertyChanged(new PropertyChangedEventArgs("AggregateMessage")); - - var handler = this.StateChangedEvent; - if (handler != null) - handler(this, EventArgs.Empty); - } - - #endregion - } -} diff --git a/Sources/WPF4.SrkToolkit.Mvvm/Tools/BusyTaskType.cs b/Sources/WPF4.SrkToolkit.Mvvm/Tools/BusyTaskType.cs deleted file mode 100644 index f2187fc..0000000 --- a/Sources/WPF4.SrkToolkit.Mvvm/Tools/BusyTaskType.cs +++ /dev/null @@ -1,44 +0,0 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace SrkToolkit.Mvvm.Tools -{ - /// - /// Represents the state of a task. - /// - public enum BusyTaskType - { - /// - /// Normal state. - /// - Default, - - /// - /// The operation was successful. - /// - Confirmation, - - /// - /// The operation failed. - /// - Error, - - /// - /// The operation encoutered an issue. - /// - Warning, - } -} diff --git a/Sources/WPF4.SrkToolkit.Mvvm/Tools/IMessageBoxService.cs b/Sources/WPF4.SrkToolkit.Mvvm/Tools/IMessageBoxService.cs deleted file mode 100644 index f196d70..0000000 --- a/Sources/WPF4.SrkToolkit.Mvvm/Tools/IMessageBoxService.cs +++ /dev/null @@ -1,50 +0,0 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace SrkToolkit.Mvvm.Tools -{ - using System; - using System.Windows; - - /// - /// Abstraction of a MessageBox. - /// - public interface IMessageBoxService - { - /// - /// Displays a message box that contains the specified text and an OK button. - /// - /// The message to display. - /// System.Windows.MessageBoxResult.OK in all cases. - MessageBoxResult Show(string messageBoxText); - - /// - /// Displays a message box that contains the specified text, title bar caption, and response buttons. - /// - /// The message to display. - /// The title of the message box. - /// A value that indicates the button or buttons to display. - /// A value that indicates the user's response to the message. - MessageBoxResult Show(string messageBoxText, string caption, MessageBoxButton button); - - /// - /// Displays a message box that contains the specified text and an OK button only when debugging. - /// - /// The message to display. - /// System.Windows.MessageBoxResult.OK in all cases. - MessageBoxResult ShowDebug(string messageBoxText); - } -} diff --git a/Sources/WPF4.SrkToolkit.Mvvm/Tools/MessageBoxService.cs b/Sources/WPF4.SrkToolkit.Mvvm/Tools/MessageBoxService.cs deleted file mode 100644 index 423682f..0000000 --- a/Sources/WPF4.SrkToolkit.Mvvm/Tools/MessageBoxService.cs +++ /dev/null @@ -1,112 +0,0 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace SrkToolkit.Mvvm.Tools -{ - using System; - using System.Windows; - using System.Diagnostics; - - /// - /// Abstraction of the MessageBox component. - /// - public class MessageBoxService : IMessageBoxService - { - private readonly Func action; - - /// - /// Initializes a new instance of the class using the real MessageBox implementation. - /// - public MessageBoxService() - { - } - - /// - /// Initializes a new instance of the class using a fake MessageBox implementation. - /// - /// The action. - public MessageBoxService(Func action) - { - this.action = action; - } - - /// - /// Displays a message box that contains the specified text and an OK button only when debugging. - /// - /// The message to display. - /// - /// System.Windows.MessageBoxResult.OK in all cases. - /// - [DebuggerStepThrough] - public MessageBoxResult ShowDebug(string messageBoxText) - { -#if DEBUG - if (action != null) - { - return action(messageBoxText, null, MessageBoxButton.OK); - } - else - { - return MessageBox.Show(messageBoxText); - } -#else - return MessageBoxResult.OK; -#endif - } - - /// - /// Displays a message box that contains the specified text and an OK button. - /// - /// The message to display. - /// - /// System.Windows.MessageBoxResult.OK in all cases. - /// - [DebuggerStepThrough] - public MessageBoxResult Show(string messageBoxText) - { - if (action != null) - { - return action(messageBoxText, null, MessageBoxButton.OK); - } - else - { - return MessageBox.Show(messageBoxText); - } - } - - /// - /// Displays a message box that contains the specified text, title bar caption, and response buttons. - /// - /// The message to display. - /// The title of the message box. - /// A value that indicates the button or buttons to display. - /// - /// A value that indicates the user's response to the message. - /// - [DebuggerStepThrough] - public MessageBoxResult Show(string messageBoxText, string caption, MessageBoxButton button) - { - if (action != null) - { - return action(messageBoxText, caption, button); - } - else - { - return MessageBox.Show(messageBoxText, caption, button); - } - } - } -} diff --git a/Sources/WPF4.SrkToolkit.Mvvm/ViewModelBase.Common.cs b/Sources/WPF4.SrkToolkit.Mvvm/ViewModelBase.Common.cs deleted file mode 100644 index aa11b46..0000000 --- a/Sources/WPF4.SrkToolkit.Mvvm/ViewModelBase.Common.cs +++ /dev/null @@ -1,249 +0,0 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace SrkToolkit.Mvvm -{ - using SrkToolkit.Mvvm.Tools; - using System; - using System.ComponentModel; - using System.Diagnostics; - using System.Diagnostics.CodeAnalysis; -#if SILVERLIGHT || WPF - using System.Windows; - using System.Windows.Threading; -#elif UWP - using Windows.ApplicationModel; -#endif - using System.Reflection; - using System.Runtime.CompilerServices; - - /// - /// A base class for the ViewModel classes in the MVVM pattern. - /// - public partial class ViewModelBase : INotifyPropertyChanged, IDisposable - { - private bool _disposed; - - #region Threading - -#if SILVERLIGHT || WPF - /// - /// Contains the UI Dispatcher. - /// Use the property instead. - /// - private Dispatcher dispatcher; - - /// - /// Gets or sets the UI Dispatcher. - /// - public Dispatcher Dispatcher - { - get { return this.dispatcher; } - set { this.dispatcher = value; } - } - - /// - /// Executes the specified delegate asynchronously on the thread the is associated with. - /// Will do nothing if is null or is true. - /// - /// - /// A delegate to a method that takes no arguments and does not return a value, which is pushed onto the event queue. - /// - protected internal void Dispatch(Action action) - { - ////if (this.Disposed) - //// throw new ObjectDisposedException(this.GetType().Name); - ////if (this.Dispatcher == null) - //// throw new ArgumentException("Dispatcher is not set"); - - if (this.Dispatcher != null && !this.Disposed && action != null) - this.Dispatcher.BeginInvoke(action, null); - } - -#endif - - #endregion - - #region Is in design mode awareness - - private static bool? _isInDesignMode; - - /// - /// Gets a value indicating whether is in design mode. - /// - /// - /// true if is in design mode static; otherwise, false. - /// - [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Justification = "Non static member needed for data binding")] - public bool IsInDesignMode - { - get - { - return IsInDesignModeStatic; - } - } - - /// - /// Gets a value indicating whether this instance is in design mode. - /// - /// - /// true if this instance is in design mode; otherwise, false. - /// - [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "The security risk here is neglectible.")] - public static bool IsInDesignModeStatic - { - get - { -#if WPF - if (!_isInDesignMode.HasValue) - { - _isInDesignMode = new bool?((bool)DependencyPropertyDescriptor.FromProperty(DesignerProperties.IsInDesignModeProperty, typeof(FrameworkElement)).Metadata.DefaultValue); - if (!(_isInDesignMode.Value || !Process.GetCurrentProcess().ProcessName.StartsWith("devenv", StringComparison.Ordinal))) - { - _isInDesignMode = true; - } - } -#elif SILVERLIGHT - if (!_isInDesignMode.HasValue) - { - _isInDesignMode = (bool)DesignerProperties.IsInDesignModeProperty.GetMetadata(typeof(DependencyObject)).DefaultValue; - } -#elif UWP - _isInDesignMode = DesignMode.DesignModeEnabled; -#else - throw new NotSupportedException(); -#endif - return _isInDesignMode.Value; - } - } - - #endregion - - #region Property change notification - - /// - /// Changes a property's value and notifies the view. - /// - /// the property type - /// a reference to a field - /// the new value - /// the public property name for change notification - /// - /// returns true if the new value is different from the old one - /// - protected bool SetValue(ref T property, T value, string propertyName) - { - if (Object.Equals(property, value)) - return false; - property = value; - this.RaisePropertyChanged(propertyName); - return true; - } - - /// - /// Raises the property changed. - /// - /// Name of the property. - [SuppressMessage("Microsoft.Design", "CA1030:UseEventsWhereAppropriate", Justification = "This cannot be an event")] - protected virtual void RaisePropertyChanged(string propertyName) - { - this.VerifyPropertyName(propertyName); - PropertyChangedEventHandler propertyChanged = this.PropertyChanged; - if (propertyChanged != null) - { - propertyChanged(this, new PropertyChangedEventArgs(propertyName)); - } - } - - /// - /// Verifies the name of the property. - /// - /// Name of the property. - [Conditional("DEBUG"), DebuggerStepThrough] - public void VerifyPropertyName(string propertyName) - { -#if SILVERLIGHT || WPF - if (base.GetType().GetProperty(propertyName) == null) - { - throw new ArgumentException("Property'" + propertyName + "' not found on " + this.GetType().FullName, propertyName); - } -#elif UWP - if (base.GetType().GetTypeInfo().GetDeclaredProperty(propertyName) == null) - { - throw new ArgumentException("Property'" + propertyName + "' not found on " + this.GetType().FullName, propertyName); - } -#endif - } - - #region INotifyPropertyChanged Members -#pragma warning disable 1591 - - /// - /// Occurs when a property value changes. - /// - public event PropertyChangedEventHandler PropertyChanged; - -#pragma warning restore 1591 - #endregion - - #endregion - - #region Cleanup - - /// - /// Gets a value indicating whether this instance is disposed. - /// - /// - /// true if disposed; otherwise, false. - /// - protected bool Disposed - { - get { return this._disposed; } - } - - #region IDisposable Members -#pragma warning disable 1591 - - public void Dispose() - { - this.Dispose(true); - GC.SuppressFinalize(this); - } - -#pragma warning restore 1591 - #endregion - - /// - /// Dispose method to free resources. - /// The object will not be usable anymore. - /// Always call the parent method. - /// Clears the . - /// Clears the event handler. - /// - /// - protected virtual void Dispose(bool disposing) - { - if (disposing) - { - this.PropertyChanged = null; - } - - this._disposed = true; - } - - #endregion - } -} diff --git a/Sources/WPF4.SrkToolkit.Mvvm/ViewModelBase.cs b/Sources/WPF4.SrkToolkit.Mvvm/ViewModelBase.cs deleted file mode 100644 index 0bfc5d4..0000000 --- a/Sources/WPF4.SrkToolkit.Mvvm/ViewModelBase.cs +++ /dev/null @@ -1,83 +0,0 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace SrkToolkit.Mvvm -{ - using System; - using System.ComponentModel; - using System.Diagnostics; - using System.Diagnostics.CodeAnalysis; -#if SILVERLIGHT || WPF - using System.Windows.Threading; -#elif UWP - using Windows.ApplicationModel; -#endif - - partial class ViewModelBase - { - - #region Threading - - /// - /// Initializes a new instance of the class. - /// Make sure you instantiate this in the UI thread so that the dispatcher can attach. - /// - protected ViewModelBase() - { -#if SILVERLIGHT || WPF - this.Dispatcher = Dispatcher.CurrentDispatcher; -#endif - } - - /// - /// Executes the specified delegate asynchronously on the thread the is associated with at a priority. - /// Will do nothing if is null or is true. - /// - /// - /// A delegate to a method that takes no arguments and does not return a value, which is pushed onto the event queue. - /// - [Obsolete("Use the Dispatcher property instead")] - protected void DispatchBackground(Action action) - { -#if SILVERLIGHT || WPF - if (this.Dispatcher != null && !this.Disposed && action != null) - this.Dispatcher.BeginInvoke(action, DispatcherPriority.Background, null); -#endif - } - - /// - /// Executes the specified delegate asynchronously on the thread the is associated with at a priority. - /// Will do nothing if is null or is true. - /// - /// - /// A delegate to a method that takes no arguments and does not return a value, which is pushed onto the event queue. - /// - [Obsolete("Use the Dispatcher property instead")] - protected void DispatchApplicationIdle(Action action) - { -#if SILVERLIGHT || WPF - if (this.Dispatcher != null && !this.Disposed && action != null) - this.Dispatcher.BeginInvoke(action, DispatcherPriority.ApplicationIdle, null); -#endif - } - - #endregion - - #region Is in design mode awareness - - #endregion - } -} diff --git a/Sources/WPF4.SrkToolkit.Mvvm/WPF4.SrkToolkit.Mvvm.csproj b/Sources/WPF4.SrkToolkit.Mvvm/WPF4.SrkToolkit.Mvvm.csproj deleted file mode 100644 index 1d82b7d..0000000 --- a/Sources/WPF4.SrkToolkit.Mvvm/WPF4.SrkToolkit.Mvvm.csproj +++ /dev/null @@ -1,82 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {A842E52E-4001-4BD8-BDCD-C95630D984D4} - Library - Properties - SrkToolkit.Mvvm - SrkToolkit.Mvvm - v4.0 - 512 - - - true - full - false - bin\Debug\ - TRACE;DEBUG;WPF - prompt - 4 - AllRules.ruleset - false - bin\Debug\SrkToolkit.Mvvm.XML - - - pdbonly - true - ..\..\Binaries\WPF4\ - TRACE;WPF - prompt - 4 - ..\..\Binaries\WPF4\SrkToolkit.Mvvm.xml - - - true - - - SrkToolkit.snk - - - - - - - - - - - - - - - - - SrkToolkit.Mvvm.AssemblyInfo.cs - - - VisualStateChangeEventArgs.cs - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Sources/WPF4.SrkToolkit.Xaml/Behaviors/WindowControls.cs b/Sources/WPF4.SrkToolkit.Xaml/Behaviors/WindowControls.cs deleted file mode 100644 index 07cf2dd..0000000 --- a/Sources/WPF4.SrkToolkit.Xaml/Behaviors/WindowControls.cs +++ /dev/null @@ -1,646 +0,0 @@ - -namespace SrkToolkit.Xaml.Behaviors -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Text; - using System.Windows.Interactivity; - using System.Windows; - using System.Windows.Interop; - using System.Windows.Input; - using System.Runtime.InteropServices; - using System.Threading; - using System.Windows.Threading; - using SrkToolkit.Mvvm.Commands; - - /// - /// - /// - /// - /// http://10rem.net/blog/2010/01/09/a-wpf-behavior-for-window-resize-events-in-net-35 - /// http://digitalmoosetracks.com/blog/wpf-transparent-window-with-resizing - /// http://www.codeproject.com/KB/WPF/WPF_Window_Resizing.aspx - /// - public class WindowControls : Behavior - { - #region Constants - - private const Int32 WM_EXITSIZEMOVE = 0x0232; - private const Int32 WM_SIZING = 0x0214; - private const Int32 WM_SIZE = 0x0005; - private const Int32 SIZE_RESTORED = 0x0000; - private const Int32 SIZE_MINIMIZED = 0x0001; - private const Int32 SIZE_MAXIMIZED = 0x0002; - private const Int32 SIZE_MAXSHOW = 0x0003; - private const Int32 SIZE_MAXHIDE = 0x0004; - private const Int32 WM_SYSCOMMAND = 0x112; - - //private Dictionary cursors = new Dictionary - //{ - // { ResizeDirection.Top, Cursors.SizeNS }, - // { ResizeDirection.Bottom, Cursors.SizeNS }, - // { ResizeDirection.Left, Cursors.SizeWE }, - // { ResizeDirection.Right, Cursors.SizeWE }, - // { ResizeDirection.TopLeft, Cursors.SizeNWSE }, - // { ResizeDirection.BottomRight, Cursors.SizeNWSE }, - // { ResizeDirection.TopRight, Cursors.SizeNESW }, - // { ResizeDirection.BottomLeft, Cursors.SizeNESW }, - //}; - - //private enum ResizeDirection { - // Left = 1, - // Right = 2, - // Top = 3, - // TopLeft = 4, - // TopRight = 5, - // Bottom = 6, - // BottomLeft = 7, - // BottomRight = 8, - //} - - #endregion - - #region Bad stuff - - private HwndSourceHook _hook; - private HwndSource source; - - [DllImport("user32.dll")] - [return: MarshalAs(UnmanagedType.Bool)] - static extern bool GetCursorPos(out PointAPI lpPoint); - - private struct PointAPI - { - public int X; - public int Y; - } - - #endregion - - #region Resize - - private bool resizeRight = false; - private bool resizeLeft = false; - private bool resizeUp = false; - private bool resizeDown = false; - - private Dictionary leftElements = new Dictionary(); - private Dictionary rightElements = new Dictionary(); - private Dictionary upElements = new Dictionary(); - private Dictionary downElements = new Dictionary(); - - private PointAPI resizePoint = new PointAPI(); - private Size resizeSize = new Size(); - private Point resizeWindowPoint = new Point(); - - private delegate void RefreshDelegate(); - - private Dispatcher dispatcher; - - #endregion - - #region Dependency property: LeftResizeElements - - public string LeftResizeElements - { - get { return (string)GetValue(LeftResizeElementsProperty); } - set { SetValue(LeftResizeElementsProperty, value); } - } - - public static readonly DependencyProperty LeftResizeElementsProperty = - DependencyProperty.Register( - "LeftResizeElements", - typeof(string), - typeof(WindowControls), - new UIPropertyMetadata(null, OnLeftResizeElementsPropertyChanged)); - - private static void OnLeftResizeElementsPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - var me = (WindowControls)d; - var names = e.NewValue as string; - - OnResizeElementsPropertyChanged(me, names, me.leftElements); - } - - #endregion - - #region Dependency property: RightResizeElements - - public string RightResizeElements - { - get { return (string)GetValue(RightResizeElementsProperty); } - set { SetValue(RightResizeElementsProperty, value); } - } - - public static readonly DependencyProperty RightResizeElementsProperty = - DependencyProperty.Register( - "RightResizeElements", - typeof(string), - typeof(WindowControls), - new UIPropertyMetadata(null, OnRightResizeElementsPropertyChanged)); - - private static void OnRightResizeElementsPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - var me = (WindowControls)d; - var names = e.NewValue as string; - - OnResizeElementsPropertyChanged(me, names, me.rightElements); - } - - #endregion - - #region Dependency property: TopResizeElements - - public string TopResizeElements - { - get { return (string)GetValue(TopResizeElementsProperty); } - set { SetValue(TopResizeElementsProperty, value); } - } - - public static readonly DependencyProperty TopResizeElementsProperty = - DependencyProperty.Register( - "TopResizeElements", - typeof(string), - typeof(WindowControls), - new UIPropertyMetadata(null, OnTopResizeElementsPropertyChanged)); - - private static void OnTopResizeElementsPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - var me = (WindowControls)d; - var names = e.NewValue as string; - - OnResizeElementsPropertyChanged(me, names, me.upElements); - } - - #endregion - - #region Dependency property: BottomResizeElements - - public string BottomResizeElements - { - get { return (string)GetValue(BottomResizeElementsProperty); } - set { SetValue(BottomResizeElementsProperty, value); } - } - - public static readonly DependencyProperty BottomResizeElementsProperty = - DependencyProperty.Register( - "BottomResizeElements", - typeof(string), - typeof(WindowControls), - new UIPropertyMetadata(null, OnBottomResizeElementsPropertyChanged)); - - private static void OnBottomResizeElementsPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - var me = (WindowControls)d; - var names = e.NewValue as string; - - OnResizeElementsPropertyChanged(me, names, me.downElements); - } - - private static void OnResizeElementsPropertyChanged(WindowControls me, string names, Dictionary list) - { - if (!string.IsNullOrEmpty(names) && me.AssociatedObject != null) - { - foreach (var name in names.Split(' ', ',', ';')) - { - var elem = me.AssociatedObject.FindName(name) as UIElement; - if (elem != null) - { - if (!me.IsResizerRegistered(elem)) - me.ConnectMouseHandlers(elem); - if (!list.ContainsKey(elem)) - list.Add(elem, 0); - } - } - } - } - - #endregion - - #region Commands - - /// - /// Maximize/windowize command. - /// To be bound in the view. - /// - public ICommand MaximizeCommand - { - [System.Diagnostics.DebuggerStepThrough] - get { return this.maximizeCommand ?? (this.maximizeCommand = new RelayCommand(this.OnMaximize)); } - } - private ICommand maximizeCommand; - - private void OnMaximize() - { - this.AssociatedObject.WindowState = (this.AssociatedObject.WindowState == WindowState.Normal) - ? WindowState.Maximized : WindowState.Normal; - } - - /// - /// Minimize command. - /// To be bound in the view. - /// - public ICommand MinimizeCommand - { - [System.Diagnostics.DebuggerStepThrough] - get { return this.minimizeCommand ?? (this.minimizeCommand = new RelayCommand(this.OnMinimize)); } - } - private ICommand minimizeCommand; - - private void OnMinimize() - { - this.AssociatedObject.WindowState = (this.AssociatedObject.WindowState == WindowState.Minimized) - ? WindowState.Normal : WindowState.Minimized; - } - - /// - /// Close command. - /// To be bound in the view. - /// - public ICommand CloseCommand - { - [System.Diagnostics.DebuggerStepThrough] - get { return this.closeCommand ?? (this.closeCommand = new RelayCommand(this.OnClose)); } - } - private ICommand closeCommand; - - private void OnClose() - { - this.AssociatedObject.Close(); - } - - #endregion - - #region Events - - public event EventHandler Resized; - public event EventHandler Resizing; - public event EventHandler Maximized; - public event EventHandler Minimized; - public event EventHandler Restored; - - #endregion - - #region Init and cleanup - - protected override void OnAttached() - { - base.OnAttached(); - - this.dispatcher = this.AssociatedObject.Dispatcher; - - this.AssociatedObject.Loaded += (s, e) => this.WireUpWndProc(); - this.AssociatedObject.MouseLeftButtonDown += this.OnInputDown; - this.AssociatedObject.TouchDown += this.OnInputDown; - } - - void OnInputDown(object sender, RoutedEventArgs e) - { - if (sender is Window && !this.AssociatedObject.AreAnyTouchesOver) - { - this.AssociatedObject.DragMove(); - e.Handled = true; - } - } - - protected override void OnDetaching() - { - this.RemoveWndProc(); - - foreach (var item in new Dictionary[] { this.leftElements, this.rightElements, this.upElements, this.downElements }) - { - foreach (var i in item) - { - if (i.Key == null) - continue; - - i.Key.MouseLeftButtonDown += this.OnResizeElementMouseLeftButtonDown; - i.Key.MouseEnter += this.OnResizeElementMouseEnter; - i.Key.MouseLeave += this.OnResizeElementMouseLeave; - } - - item.Clear(); - } - - base.OnDetaching(); - } - - private void WireUpWndProc() - { - this.source = HwndSource.FromVisual(this.AssociatedObject) as HwndSource; - - if (this.source != null) - { - this._hook = new HwndSourceHook(this.WndProc); - this.source.AddHook(this._hook); - } - - OnResizeElementsPropertyChanged(this, this.LeftResizeElements, this.leftElements); - OnResizeElementsPropertyChanged(this, this.RightResizeElements, this.rightElements); - OnResizeElementsPropertyChanged(this, this.TopResizeElements, this.upElements); - OnResizeElementsPropertyChanged(this, this.BottomResizeElements, this.downElements); - } - - private void RemoveWndProc() - { - if (this.source != null) - { - this.source.RemoveHook(this._hook); - } - } - - #endregion - - #region Bad stuff (again) - - [DllImport("user32.dll", CharSet = CharSet.Auto)] - private static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam); - - private IntPtr WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, ref Boolean handled) - { - IntPtr result = IntPtr.Zero; - - switch (msg) - { - case WM_SIZING: - OnResizing(); - break; - - case WM_SIZE: - int param = wParam.ToInt32(); - switch (param) - { - case SIZE_RESTORED: - OnRestored(); - break; - case SIZE_MINIMIZED: - OnMinimized(); - break; - case SIZE_MAXIMIZED: - OnMaximized(); - break; - case SIZE_MAXSHOW: - break; - case SIZE_MAXHIDE: - break; - } - break; - case WM_EXITSIZEMOVE: - OnResized(); - break; - } - - return result; - } - - #endregion - - #region Event raisers - - private void OnResizing() - { - var handler = this.Resizing; - if (handler != null) - handler(this.AssociatedObject, EventArgs.Empty); - } - - private void OnResized() - { - var handler = this.Resized; - if (handler != null) - handler(this.AssociatedObject, EventArgs.Empty); - } - - private void OnRestored() - { - var handler = this.Restored; - if (handler != null) - handler(this.AssociatedObject, EventArgs.Empty); - } - - private void OnMinimized() - { - var handler = this.Minimized; - if (handler != null) - handler(this.AssociatedObject, EventArgs.Empty); - } - - private void OnMaximized() - { - var handler = this.Maximized; - if (handler != null) - handler(this.AssociatedObject, EventArgs.Empty); - } - - #endregion - - #region Window resize - - public bool IsResizerRegistered(UIElement element) - { - return this.leftElements.ContainsKey(element) || this.rightElements.ContainsKey(element) || - this.upElements.ContainsKey(element) || this.downElements.ContainsKey(element); - } - - public void AddResizerRight(UIElement element) - { - this.ConnectMouseHandlers(element); - this.rightElements.Add(element, 0); - } - - public void AddResizerLeft(UIElement element) - { - this.ConnectMouseHandlers(element); - this.leftElements.Add(element, 0); - } - - public void AddResizerUp(UIElement element) - { - this.ConnectMouseHandlers(element); - this.upElements.Add(element, 0); - } - - public void AddResizerDown(UIElement element) - { - this.ConnectMouseHandlers(element); - this.downElements.Add(element, 0); - } - - public void AddResizerRightDown(UIElement element) - { - this.ConnectMouseHandlers(element); - this.rightElements.Add(element, 0); - this.downElements.Add(element, 0); - } - - public void AddResizerLeftDown(UIElement element) - { - this.ConnectMouseHandlers(element); - this.leftElements.Add(element, 0); - this.downElements.Add(element, 0); - } - - public void AddResizerRightUp(UIElement element) - { - this.ConnectMouseHandlers(element); - this.rightElements.Add(element, 0); - this.upElements.Add(element, 0); - } - - public void AddResizerLeftUp(UIElement element) - { - this.ConnectMouseHandlers(element); - this.leftElements.Add(element, 0); - this.upElements.Add(element, 0); - } - - private void ConnectMouseHandlers(UIElement element) - { - element.MouseLeftButtonDown += this.OnResizeElementMouseLeftButtonDown; - element.MouseEnter += this.OnResizeElementMouseEnter; - element.MouseLeave += this.OnResizeElementMouseLeave; - } - - private void OnResizeElementMouseLeftButtonDown(object sender, MouseButtonEventArgs e) - { - e.Handled = true; - GetCursorPos(out this.resizePoint); - this.resizeSize = new Size(this.AssociatedObject.Width, this.AssociatedObject.Height); - this.resizeWindowPoint = new Point(this.AssociatedObject.Left, this.AssociatedObject.Top); - - UIElement sourceSender = (UIElement)sender; - this.resizeLeft = this.leftElements.ContainsKey(sourceSender); - this.resizeRight = this.rightElements.ContainsKey(sourceSender); - this.resizeUp = this.upElements.ContainsKey(sourceSender); - this.resizeDown = this.downElements.ContainsKey(sourceSender); - - var t = new Thread(new ThreadStart(this.UpdateSizeLoop)); - t.Name = "Mouse Position Poll Thread"; - t.Start(); - } - - private void UpdateSizeLoop() - { - try - { - while (resizeDown || resizeLeft || resizeRight || resizeUp) - { - this.dispatcher.Invoke(DispatcherPriority.Render, new RefreshDelegate(UpdateSize)); - this.dispatcher.Invoke(DispatcherPriority.Render, new RefreshDelegate(UpdateMouseDown)); - //Thread.Sleep(2); - } - - this.dispatcher.Invoke(DispatcherPriority.Render, new RefreshDelegate(SetArrowCursor)); - } - catch - { - } - } - - private void UpdateSize() - { - PointAPI p = new PointAPI(); - GetCursorPos(out p); - - if (resizeRight) - { - this.AssociatedObject.Width = Math.Abs(this.resizeSize.Width - (resizePoint.X - p.X)) + 8; - } - - if (resizeDown) - { - this.AssociatedObject.Height = Math.Abs(resizeSize.Height - (resizePoint.Y - p.Y)) + 8; - } - - if (resizeLeft) - { - this.AssociatedObject.Width = Math.Abs(resizeSize.Width + (resizePoint.X - p.X)) + 8; - this.AssociatedObject.Left = resizeWindowPoint.X - (resizePoint.X - p.X); - } - - if (resizeUp) - { - this.AssociatedObject.Height = Math.Abs(resizeSize.Height + (resizePoint.Y - p.Y)) + 8; - this.AssociatedObject.Top = resizeWindowPoint.Y - (resizePoint.Y - p.Y); - } - } - - private void UpdateMouseDown() - { - if (Mouse.LeftButton == MouseButtonState.Released) - { - resizeRight = false; - resizeLeft = false; - resizeUp = false; - resizeDown = false; - } - } - - private void OnResizeElementMouseEnter(object sender, MouseEventArgs e) - { - bool resizeRight = false; - bool resizeLeft = false; - bool resizeUp = false; - bool resizeDown = false; - - UIElement sourceSender = (UIElement)sender; - resizeLeft = this.leftElements.ContainsKey(sourceSender); - resizeRight = this.rightElements.ContainsKey(sourceSender); - resizeUp = this.upElements.ContainsKey(sourceSender); - resizeDown = this.downElements.ContainsKey(sourceSender); - - if ((resizeLeft && resizeDown) || (resizeRight && resizeUp)) - { - this.SetNESWCursor(sender, e); - } - else if ((resizeRight && resizeDown) || (resizeLeft && resizeUp)) - { - this.SetNWSECursor(sender, e); - } - else if (resizeLeft || resizeRight) - { - this.SetWECursor(sender, e); - } - else if (resizeUp || resizeDown) - { - this.SetNSCursor(sender, e); - } - } - - private void SetWECursor(object sender, MouseEventArgs e) - { - this.AssociatedObject.Cursor = Cursors.SizeWE; - } - - private void SetNSCursor(object sender, MouseEventArgs e) - { - this.AssociatedObject.Cursor = Cursors.SizeNS; - } - - private void SetNESWCursor(object sender, MouseEventArgs e) - { - this.AssociatedObject.Cursor = Cursors.SizeNESW; - } - - private void SetNWSECursor(object sender, MouseEventArgs e) - { - this.AssociatedObject.Cursor = Cursors.SizeNWSE; - } - - private void OnResizeElementMouseLeave(object sender, MouseEventArgs e) - { - if (!resizeDown && !resizeLeft && !resizeRight && !resizeUp) - { - this.AssociatedObject.Cursor = Cursors.Arrow; - } - } - - private void SetArrowCursor() - { - this.AssociatedObject.Cursor = Cursors.Arrow; - } - - #endregion - } -} diff --git a/Sources/WPF4.SrkToolkit.Xaml/Converters/BoolToVisibilityConverter.cs b/Sources/WPF4.SrkToolkit.Xaml/Converters/BoolToVisibilityConverter.cs deleted file mode 100644 index b1a806f..0000000 --- a/Sources/WPF4.SrkToolkit.Xaml/Converters/BoolToVisibilityConverter.cs +++ /dev/null @@ -1,133 +0,0 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace SrkToolkit.Xaml.Converters -{ - using System; - using System.Diagnostics.CodeAnalysis; - using System.Globalization; - using System.Windows; - using System.Windows.Data; - - /// - /// Converts a boolean to a . - /// - public class BoolToVisibilityConverter : IValueConverter - { - #region IValueConverter Members - - /// - /// Converts a boolean to a . - /// If value is null, is returned. - /// - /// - /// a boolean to convert (nullable or not) - /// - /// - /// - /// Reverse the behavior if begins with '!'. - /// Will return for null value if it contains 'N'. - /// Will return instead of if it contains 'H'. - /// - /// - /// - [SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily", Justification = "CA is wrong")] - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - bool reverse = false; - bool val = false; - bool showIfNull = false; - bool hide = false; - var valueForHide = Visibility.Collapsed; - - // parse parameter - if (parameter is string) - { - string strparam = (string)parameter; - if (strparam.Length > 0) - { - reverse = strparam[0] == '!'; - showIfNull = strparam.IndexOf('N') >= 0; - hide = strparam.IndexOf('H') >= 0; - } - else - { - reverse = false; - } - } - else if (parameter is bool) - { - reverse = (bool)parameter; - } - else if (parameter is bool?) - { - bool? p = ((bool?)parameter); - reverse = p.HasValue && p.Value; - } - -#if !SILVERLIGHT - // Hidden instead of Collapsed? - // Silverlight doesn't support this :) - if (hide) - valueForHide = Visibility.Hidden; -#endif - - // parse value - if (value == null) - { - return showIfNull ? Visibility.Visible : valueForHide; - } - else if (value is string) - { - val = bool.Parse((string)value); - } - else if (value is bool) - { - val = (bool)value; - } - else if (value is bool?) - { - bool? p = (bool?)value; - if (p.HasValue) - val = p.Value; - else - return showIfNull ? Visibility.Visible : valueForHide; - } - - if (reverse) - return !val ? Visibility.Visible : valueForHide; - else - return val ? Visibility.Visible : valueForHide; - } - - /// - /// Modifies the target data before passing it to the source object. This method is called only in bindings. - /// - /// The target data being passed to the source. - /// The of data expected by the source object. - /// An optional parameter to be used in the converter logic. - /// The culture of the conversion. - /// - /// The value to be passed to the source object. - /// - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotSupportedException(); - } - - #endregion - } -} diff --git a/Sources/WPF4.SrkToolkit.Xaml/Converters/DateTimeDateConverter.cs b/Sources/WPF4.SrkToolkit.Xaml/Converters/DateTimeDateConverter.cs deleted file mode 100644 index 4de18c4..0000000 --- a/Sources/WPF4.SrkToolkit.Xaml/Converters/DateTimeDateConverter.cs +++ /dev/null @@ -1,80 +0,0 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace SrkToolkit.Xaml.Converters -{ - using System; - using System.Globalization; - using System.Windows; - using System.Windows.Data; - - /// - /// Displays a date from a . - /// - public class DateTimeDateConverter : IValueConverter - { - #region IValueConverter Members - - /// - /// Converts a value. - /// - /// The value produced by the binding source. - /// The type of the binding target property. - /// The converter parameter to use. - /// The culture to use in the converter. - /// - /// A converted value. If the method returns null, the valid null value is used. - /// - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - DateTime? val = null; - if (value is DateTime?) - { - val = (DateTime?)value; - } - - if (value is DateTime) - { - DateTime val2 = (DateTime)value; - val = val2; - } - - if (val.HasValue) - { - return val.Value.ToLongDateString(); - } - - return null; - } - - /// - /// Converts a value. - /// - /// The value that is produced by the binding target. - /// The type to convert to. - /// The converter parameter to use. - /// The culture to use in the converter. - /// - /// A converted value. If the method returns null, the valid null value is used. - /// - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotSupportedException(); - } - - #endregion - } -} diff --git a/Sources/WPF4.SrkToolkit.Xaml/Converters/NotNullToVisibilityConverter.cs b/Sources/WPF4.SrkToolkit.Xaml/Converters/NotNullToVisibilityConverter.cs deleted file mode 100644 index 4db24f5..0000000 --- a/Sources/WPF4.SrkToolkit.Xaml/Converters/NotNullToVisibilityConverter.cs +++ /dev/null @@ -1,114 +0,0 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace SrkToolkit.Xaml.Converters -{ - using System; - using System.Diagnostics.CodeAnalysis; - using System.Globalization; - using System.Windows; - using System.Windows.Data; - - /// - /// Converts a value to a depending on the "nullability" of it. - /// - public class NotNullToVisibilityConverter : IValueConverter - { - #region IValueConverter Members - - /// - /// Converts a value to a depending on it's existence (null or not). - /// If value is null, is returned. - /// If value is not null, is returned. - /// - /// - /// - /// - /// - /// Reverse the behavior if begins with '!'. - /// Will return instead of if it contains 'H'. - /// - /// - /// - [SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily", Justification = "CA is wrong")] - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - bool reverse = false; - bool hide = false; - var vHide = Visibility.Collapsed; - - // parse parameter - if (parameter is string) - { - string strparam = (string)parameter; - if (strparam.Length > 0) - { - reverse = strparam[0] == '!'; - hide = strparam.IndexOf('H') >= 0; - } - else - { - reverse = false; - } - } - else if (parameter is bool) - reverse = (bool)parameter; - else if (parameter is bool?) - { - bool? p = ((bool?)parameter); - reverse = p.HasValue && p.Value; - } - -#if !SILVERLIGHT - if (hide) - vHide = Visibility.Hidden; -#endif - - // parse value - if (value is string) - { - if (reverse) - return string.IsNullOrEmpty((string)value) ? Visibility.Visible : vHide; - else - return !string.IsNullOrEmpty((string)value) ? Visibility.Visible : vHide; - } - else - { - if (reverse) - return value == null ? Visibility.Visible : vHide; - else - return value != null ? Visibility.Visible : vHide; - } - } - - /// - /// Modifies the target data before passing it to the source object. This method is called only in bindings. - /// - /// The target data being passed to the source. - /// The of data expected by the source object. - /// An optional parameter to be used in the converter logic. - /// The culture of the conversion. - /// - /// The value to be passed to the source object. - /// - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotSupportedException(); - } - - #endregion - } -} diff --git a/Sources/WPF4.SrkToolkit.Xaml/Converters/OppositeBoolConverter.cs b/Sources/WPF4.SrkToolkit.Xaml/Converters/OppositeBoolConverter.cs deleted file mode 100644 index d7a8500..0000000 --- a/Sources/WPF4.SrkToolkit.Xaml/Converters/OppositeBoolConverter.cs +++ /dev/null @@ -1,72 +0,0 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace SrkToolkit.Xaml.Converters -{ - using System; - using System.Globalization; - using System.Windows; - using System.Windows.Data; - - /// - /// Converts a boolean value to its opposite. - /// - public class OppositeBoolConverter : IValueConverter - { - #region IValueConverter Members - - /// - /// Converts a value. - /// - /// The value produced by the binding source. - /// The type of the binding target property. - /// The converter parameter to use. - /// The culture to use in the converter. - /// - /// A converted value. If the method returns null, the valid null value is used. - /// - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - if (value == null) - return null; - - if (value is bool) - return !(bool)value; - - if (value is bool?) - return !((bool?)value).GetValueOrDefault(); - - throw new ArgumentException("The value should be a boolean, " + value.GetType().Name + " provided", "value"); - } - - /// - /// Converts a value. - /// - /// The value that is produced by the binding target. - /// The type to convert to. - /// The converter parameter to use. - /// The culture to use in the converter. - /// - /// A converted value. If the method returns null, the valid null value is used. - /// - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotSupportedException(); - } - - #endregion - } -} diff --git a/Sources/WPF4.SrkToolkit.Xaml/Converters/ToLowerConverter.cs b/Sources/WPF4.SrkToolkit.Xaml/Converters/ToLowerConverter.cs deleted file mode 100644 index a59a820..0000000 --- a/Sources/WPF4.SrkToolkit.Xaml/Converters/ToLowerConverter.cs +++ /dev/null @@ -1,40 +0,0 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace SrkToolkit.Xaml.Converters -{ - using System; - using System.Globalization; - using System.Windows.Data; - - /// - /// Displays a string lower-cased. - /// - public class ToLowerConverter : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - if (value != null) - return ((string)value).ToLower(culture); - return null; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - return value; - } - } -} diff --git a/Sources/WPF4.SrkToolkit.Xaml/Converters/ToUpperConverter.cs b/Sources/WPF4.SrkToolkit.Xaml/Converters/ToUpperConverter.cs deleted file mode 100644 index 7098d38..0000000 --- a/Sources/WPF4.SrkToolkit.Xaml/Converters/ToUpperConverter.cs +++ /dev/null @@ -1,40 +0,0 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace SrkToolkit.Xaml.Converters -{ - using System; - using System.Globalization; - using System.Windows.Data; - - /// - /// Displays a string upper-cased. - /// - public class ToUpperConverter : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - if (value != null) - return ((string)value).ToUpper(culture); - return null; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - return value; - } - } -} diff --git a/Sources/WPF4.SrkToolkit.Xaml/Extensions/DispatcherExtensions.cs b/Sources/WPF4.SrkToolkit.Xaml/Extensions/DispatcherExtensions.cs deleted file mode 100644 index 79736fc..0000000 --- a/Sources/WPF4.SrkToolkit.Xaml/Extensions/DispatcherExtensions.cs +++ /dev/null @@ -1,92 +0,0 @@ - -namespace System.Windows.Threading -{ - using System; - - public static class DispatcherExtensions - { - /// - /// Executes the specified delegate asynchronously with the specified arguments on the thread that the - /// System.Windows.Threading.Dispatcher was created on. - /// - /// - /// - /// The delegate to a method that takes parameters specified in args, which is pushed onto the - /// System.Windows.Threading.Dispatcher event queue. - /// - /// - /// An object, which is returned immediately after Overload:System.Windows.Threading.Dispatcher.BeginInvoke - /// is called, that can be used to interact with the delegate as it is pending - /// execution in the event queue. - /// - public static DispatcherOperation BeginInvoke(this Dispatcher dispatcher, Action action) - { - return dispatcher.BeginInvoke(action); - } - - /// - /// Executes the specified delegate asynchronously with the specified arguments on the thread that the - /// System.Windows.Threading.Dispatcher was created on. - /// - /// - /// - /// The delegate to a method that takes parameters specified in args, which is pushed onto the - /// System.Windows.Threading.Dispatcher event queue. - /// - /// - /// The priority, relative to the other pending operations in the System.Windows.Threading.Dispatcher - /// - /// - /// An object, which is returned immediately after Overload:System.Windows.Threading.Dispatcher.BeginInvoke - /// is called, that can be used to interact with the delegate as it is pending - /// execution in the event queue. - /// - public static DispatcherOperation BeginInvoke(this Dispatcher dispatcher, Action action, DispatcherPriority priority) - { - return dispatcher.BeginInvoke(action, priority); - } - - /// - /// Executes the specified delegate asynchronously with the specified arguments on the thread that the - /// System.Windows.Threading.Dispatcher was created on. - /// - /// - /// - /// The delegate to a method that takes parameters specified in args, which is pushed onto the - /// System.Windows.Threading.Dispatcher event queue. - /// - /// - /// The priority, relative to the other pending operations in the System.Windows.Threading.Dispatcher - /// - /// - /// An object, which is returned immediately after Overload:System.Windows.Threading.Dispatcher.BeginInvoke - /// is called, that can be used to interact with the delegate as it is pending - /// execution in the event queue. - /// - /// An array of objects to pass as arguments to the given method. Can be null. - public static DispatcherOperation BeginInvoke(this Dispatcher dispatcher, Action action, DispatcherPriority priority, params object[] args) - { - return dispatcher.BeginInvoke(action, priority, args); - } - - /// - /// Executes the specified delegate asynchronously with the specified arguments on the thread that the - /// System.Windows.Threading.Dispatcher was created on. - /// - /// - /// - /// The delegate to a method that takes parameters specified in args, which is pushed onto the - /// System.Windows.Threading.Dispatcher event queue. - /// - /// - /// An object, which is returned immediately after Overload:System.Windows.Threading.Dispatcher.BeginInvoke - /// is called, that can be used to interact with the delegate as it is pending - /// execution in the event queue. - /// - /// An array of objects to pass as arguments to the given method. Can be null. - public static DispatcherOperation BeginInvoke(this Dispatcher dispatcher, Action action, params object[] args) - { - return dispatcher.BeginInvoke(action, args); - } - } -} diff --git a/Sources/WPF4.SrkToolkit.Xaml/GlobalSuppressions.cs b/Sources/WPF4.SrkToolkit.Xaml/GlobalSuppressions.cs deleted file mode 100644 index 9df92dc..0000000 --- a/Sources/WPF4.SrkToolkit.Xaml/GlobalSuppressions.cs +++ /dev/null @@ -1,17 +0,0 @@ -// This file is used by Code Analysis to maintain SuppressMessage -// attributes that are applied to this project. -// Project-level suppressions either have no target or are given -// a specific target and scoped to a namespace, type, member, etc. -// -// To add a suppression to this file, right-click the message in the -// Error List, point to "Suppress Message(s)", and click -// "In Project Suppression File". -// You do not need to add suppressions to this file manually. - -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Srk")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Srk", Scope = "namespace", Target = "SrkToolkit.Xaml.Converters")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily", Scope = "member", Target = "SrkToolkit.Xaml.Converters.BoolToVisibilityConverter.#Convert(System.Object,System.Type,System.Object,System.Globalization.CultureInfo)")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily", Scope = "member", Target = "SrkToolkit.Xaml.Converters.NotNullToVisibilityConverter.#Convert(System.Object,System.Type,System.Object,System.Globalization.CultureInfo)")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "System.Windows")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Srk", Scope = "namespace", Target = "SrkToolkit.Xaml.Behaviors")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "SrkToolkit.Xaml.Behaviors")] diff --git a/Sources/WPF4.SrkToolkit.Xaml/Properties/AssemblyInfo.cs b/Sources/WPF4.SrkToolkit.Xaml/Properties/AssemblyInfo.cs deleted file mode 100644 index 96fa935..0000000 --- a/Sources/WPF4.SrkToolkit.Xaml/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; -using System; - -[assembly: AssemblyTitle("SrkToolkit.Xaml")] -[assembly: AssemblyDescription("XAML utilities for .NET4")] - -[assembly: CLSCompliant(true)] - diff --git a/Sources/WPF4.SrkToolkit.Xaml/RelayCommand.cs b/Sources/WPF4.SrkToolkit.Xaml/RelayCommand.cs deleted file mode 100644 index b14c2ed..0000000 --- a/Sources/WPF4.SrkToolkit.Xaml/RelayCommand.cs +++ /dev/null @@ -1,105 +0,0 @@ - -namespace SrkToolkit.Xaml.Commands -{ - using System; - using System.Windows.Input; - using System.Diagnostics; - - /// - /// Classic RelayCommand implementation for the MVVM pattern. - /// - internal class RelayCommand : ICommand - { - - private readonly Func _canExecuteFunc; - private readonly Action _executeAction; - private readonly bool canExecutePreventsExecute; - - /// - /// Event for the CanExecute feature. - /// - public event EventHandler CanExecuteChanged - { - add - { - if (this._canExecuteFunc != null) - { - CommandManager.RequerySuggested += value; - } - } - remove - { - if (this._canExecuteFunc != null) - { - CommandManager.RequerySuggested -= value; - } - } - } - - /// - /// Create a new instance that can always execute. - /// - /// the action to execute - /// If the execute argument is null. - [DebuggerStepThrough] - public RelayCommand(Action execute) - : this(execute, null, false) - { - } - - /// - /// Initializes a new instance of the RelayCommand class. - /// - /// The execution logic. - /// The execution status logic. - /// If the execute argument is null. - [DebuggerStepThrough] - public RelayCommand(Action execute, Func canExecute, bool canExecutePreventsExecute) - { - if (execute == null) - { - throw new ArgumentNullException("execute"); - } - this._executeAction = execute; - this._canExecuteFunc = canExecute; - this.canExecutePreventsExecute = canExecutePreventsExecute; - } - - /// - /// Defines the method that determines whether the command can execute in its current state. - /// - /// This parameter will always be ignored. - /// true if this command can be executed; otherwise, false. - [DebuggerStepThrough] - public bool CanExecute(object parameter) - { - return ((this._canExecuteFunc == null) ? true : this._canExecuteFunc.Invoke()); - } - - /// - /// Defines the method to be called when the command is invoked. - /// - /// This parameter will always be ignored. - [DebuggerStepThrough] - public void Execute(object parameter) - { - if (this.canExecutePreventsExecute && this._canExecuteFunc != null) - { - if (this._canExecuteFunc()) - this._executeAction.Invoke(); - } - else - { - this._executeAction.Invoke(); - } - } - - /// - /// Raises the event. - /// - public void RaiseCanExecuteChanged() - { - CommandManager.InvalidateRequerySuggested(); - } - } -} diff --git a/Sources/WPF4.SrkToolkit.Xaml/WPF4.SrkToolkit.Xaml.csproj b/Sources/WPF4.SrkToolkit.Xaml/WPF4.SrkToolkit.Xaml.csproj deleted file mode 100644 index 5d6bf46..0000000 --- a/Sources/WPF4.SrkToolkit.Xaml/WPF4.SrkToolkit.Xaml.csproj +++ /dev/null @@ -1,104 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {09A84445-2AA3-4D99-89F7-007CA3EF91A3} - library - Properties - SrkToolkit.Xaml - SrkToolkit.Xaml - v4.0 - Client - 512 - {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 4 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - AllRules.ruleset - false - bin\Debug\SrkToolkit.Xaml.xml - - - pdbonly - true - ..\..\Binaries\WPF4\ - TRACE - prompt - 4 - ..\..\Binaries\WPF4\SrkToolkit.Xaml.xml - - - true - - - SrkToolkit.snk - - - - - ..\Lib\FX40\System.Windows.Interactivity.dll - - - - - - 4.0 - - - - - - - - Behaviors\InputEnterBehavior.cs - - - Behaviors\ListBoxScrollBehavior.cs - - - Extensions\DependencyObjectExtensions.cs - - - Internal\DisposableEventHandler.cs - - - Properties\SrkToolkit.Xaml.AssemblyInfo.cs - - - - - - - - - - - - - - - Code - - - - - - - - - {A842E52E-4001-4BD8-BDCD-C95630D984D4} - WPF4.SrkToolkit.Mvvm - - - - \ No newline at end of file diff --git a/Sources/WPF45.SrkToolkit.Mvvm/Properties/AssemblyInfo.cs b/Sources/WPF45.SrkToolkit.Mvvm/Properties/AssemblyInfo.cs deleted file mode 100644 index 3e5f120..0000000 --- a/Sources/WPF45.SrkToolkit.Mvvm/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Reflection; -using System.Resources; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Windows; - -[assembly: AssemblyTitle("SrkToolkit.Mvvm for WPF 4.5")] -[assembly: AssemblyDescription("SrkToolkit.Mvvm for WPF 4.5")] - -[assembly: CLSCompliant(true)] -[assembly: Guid("10B17A69-BE19-4E66-8D2E-CA9DD2CDF256")] - -////[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] - -[assembly:ThemeInfo( - ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located - //(used if a resource is not found in the page, - // or application resource dictionaries) - ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located - //(used if a resource is not found in the page, - // app, or any theme specific resource dictionaries) -)] - diff --git a/Sources/WPF45.SrkToolkit.Mvvm/Properties/Resources.Designer.cs b/Sources/WPF45.SrkToolkit.Mvvm/Properties/Resources.Designer.cs deleted file mode 100644 index 97abd70..0000000 --- a/Sources/WPF45.SrkToolkit.Mvvm/Properties/Resources.Designer.cs +++ /dev/null @@ -1,63 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.17626 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace SrkToolkit.Mvvm.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SrkToolkit.Mvvm.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - } -} diff --git a/Sources/WPF45.SrkToolkit.Mvvm/Properties/Resources.resx b/Sources/WPF45.SrkToolkit.Mvvm/Properties/Resources.resx deleted file mode 100644 index ffecec8..0000000 --- a/Sources/WPF45.SrkToolkit.Mvvm/Properties/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Sources/WPF45.SrkToolkit.Mvvm/Properties/Settings.Designer.cs b/Sources/WPF45.SrkToolkit.Mvvm/Properties/Settings.Designer.cs deleted file mode 100644 index 93b065d..0000000 --- a/Sources/WPF45.SrkToolkit.Mvvm/Properties/Settings.Designer.cs +++ /dev/null @@ -1,26 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.17626 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace SrkToolkit.Mvvm.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - } -} diff --git a/Sources/WPF45.SrkToolkit.Mvvm/Properties/Settings.settings b/Sources/WPF45.SrkToolkit.Mvvm/Properties/Settings.settings deleted file mode 100644 index 8f2fd95..0000000 --- a/Sources/WPF45.SrkToolkit.Mvvm/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/Sources/WPF45.SrkToolkit.Mvvm/WPF45.SrkToolkit.Mvvm.csproj b/Sources/WPF45.SrkToolkit.Mvvm/WPF45.SrkToolkit.Mvvm.csproj deleted file mode 100644 index eb0101c..0000000 --- a/Sources/WPF45.SrkToolkit.Mvvm/WPF45.SrkToolkit.Mvvm.csproj +++ /dev/null @@ -1,119 +0,0 @@ - - - - - Debug - AnyCPU - {175B67BE-9042-45EE-A8DF-D96FE8B75561} - library - Properties - SrkToolkit.Mvvm - SrkToolkit.Mvvm - v4.5 - 512 - {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 4 - - - true - full - false - bin\Debug\ - TRACE;DEBUG;WPF - prompt - 4 - bin\Debug\SrkToolkit.Mvvm.xml - - - pdbonly - true - ..\..\Binaries\WPF45\ - TRACE;WPF - prompt - 4 - ..\..\Binaries\WPF45\SrkToolkit.Mvvm.xml - - - true - - - SrkToolkit.snk - - - - - - - - 4.0 - - - - - - - - Commands\RelayCommand.cs - - - Commands\RelayCommand.T.cs - - - DispatcherExtensions.cs - - - GlobalSuppressions.cs - - - InteractionViewModelBase.cs - - - System\DataEventArgs.cs - - - Tools\BusyTask.cs - - - Tools\BusyTaskCollection.cs - - - Tools\BusyTaskType.cs - - - Tools\IMessageBoxService.cs - - - Tools\MessageBoxService.cs - - - ViewModelBase.Common.cs - - - ViewModelBase.cs - - - Code - - - True - True - Resources.resx - - - True - Settings.settings - True - - - ResXFileCodeGenerator - Resources.Designer.cs - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - - - - \ No newline at end of file diff --git a/Sources/WPF45.SrkToolkit.Xaml/Properties/AssemblyInfo.cs b/Sources/WPF45.SrkToolkit.Xaml/Properties/AssemblyInfo.cs deleted file mode 100644 index 2802582..0000000 --- a/Sources/WPF45.SrkToolkit.Xaml/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("SrkToolkit.Xaml")] -[assembly: AssemblyDescription("XAML utilities for .NET4.5")] - -[assembly: Guid("405ae56c-06df-4a98-8ba9-1eafb6a2ac6f")] - diff --git a/Sources/WPF45.SrkToolkit.Xaml/WPF45.SrkToolkit.Xaml.csproj b/Sources/WPF45.SrkToolkit.Xaml/WPF45.SrkToolkit.Xaml.csproj deleted file mode 100644 index cd30e52..0000000 --- a/Sources/WPF45.SrkToolkit.Xaml/WPF45.SrkToolkit.Xaml.csproj +++ /dev/null @@ -1,103 +0,0 @@ - - - - - Debug - AnyCPU - {A6D741FB-B974-491A-A2CE-DE7F491FD66D} - Library - Properties - SrkToolkit.Xaml - SrkToolkit.Xaml - v4.5 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - bin\Debug\SrkToolkit.Xaml.xml - - - pdbonly - true - ..\..\Binaries\WPF45\ - TRACE - prompt - 4 - ..\..\Binaries\WPF45\SrkToolkit.Xaml.xml - - - true - - - SrkToolkit.snk - - - - - - - - - False - ..\..\..\..\..\spk\nwk\Libs\NET45\System.Windows.Interactivity.dll - - - - - - - - Behaviors\InputEnterBehavior.cs - - - Behaviors\ListBoxScrollBehavior.cs - - - Extensions\DependencyObjectExtensions.cs - - - SrkToolkit.Xaml.AssemblyInfo.cs - - - Behaviors\WindowControls.cs - - - Converters\BoolToVisibilityConverter.cs - - - Converters\DateTimeDateConverter.cs - - - Converters\NotNullToVisibilityConverter.cs - - - Converters\OppositeBoolConverter.cs - - - Converters\ToLowerConverter.cs - - - Converters\ToUpperConverter.cs - - - - - - - - - {175b67be-9042-45ee-a8df-d96fe8b75561} - WPF45.SrkToolkit.Mvvm - - - - - - - \ No newline at end of file From 26216c0ec615fee46b28916709b72ebbcb0e58b5 Mon Sep 17 00:00:00 2001 From: SandRock Date: Fri, 10 Mar 2023 10:37:42 +0100 Subject: [PATCH 03/34] README: explain major versions --- README.md | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 163b3f6..dc8255b 100644 --- a/README.md +++ b/README.md @@ -19,16 +19,45 @@ Branches Assemblies -------------------- +### v2.0 (netstandard2.0 and AspNetCore, keep partial support for net46) + +Keep support for latest .NET Framework and MVC5, full support for AspNetCore. + +| Assembly | FX | Nuget | Remark | +|----------------------------------------------------------|-------------------------------|--------------------------------------------------------------------|--------| +| [SrkToolkit.Common](Wiki/SrkToolkit.Common.md) | net46, netstandard2.0, net7.0 | [nuget](https://www.nuget.org/packages/SrkToolkit.Common) | | +| [SrkToolkit.Domain](Wiki/SrkToolkit.Domain.md) | net46, netstandard2.0, net7.0 | [nuget](https://www.nuget.org/packages/SrkToolkit.Domain) | | +| [SrkToolkit.Web.AspMvcCore2](Wiki/SrkToolkit.Web.md) | netstandard2.0, net7.0 | [nuget](https://www.nuget.org/packages/SrkToolkit.Web.AspMvcCore2) | | +| SrkToolkit.Domain.AspMvcCore2 | netstandard2.0, net7.0, | [nuget](https://www.nuget.org/packages/SrkToolkit.Domain.AspMvcCore2) | | + +### v1.2 (support for net40 and MVC 4, net45 and MVC 5, netstandard2.0) + +Keep support for many .NET Framework and MVC5, growing support for AspNetCore. + | Assembly | FX | Nuget | Remark | |----------------------------------------------------------|------------------------------|-----------------------------------------------------------|--------| | [SrkToolkit.Common](Wiki/SrkToolkit.Common.md) | net40, net45, netstandard2.0 | [nuget](https://www.nuget.org/packages/SrkToolkit.Common) | | -| SrkToolkit.Common.Unsafe | net40 | | | | [SrkToolkit.Domain](Wiki/SrkToolkit.Domain.md) | net40, net45, netstandard2.0 | [nuget](https://www.nuget.org/packages/SrkToolkit.Domain) | | | [SrkToolkit.Web (for ASP MVC 3)](Wiki/SrkToolkit.Web.md) | net40 | [nuget mvc4](https://www.nuget.org/packages/SrkToolkit.Web.AspMvc4) | | | [SrkToolkit.Web (for ASP MVC 4)](Wiki/SrkToolkit.Web.md) | net45 | [nuget mvc5](https://www.nuget.org/packages/SrkToolkit.Web.AspMvc5) | | | SrkToolkit.Domain.AspMvc3 | net40, | [nuget mvc4](https://www.nuget.org/packages/SrkToolkit.Domain.AspMvc4) | | | SrkToolkit.Domain.AspMvc4 | net45 | [nuget mvc5](https://www.nuget.org/packages/SrkToolkit.Domain.AspMvc5) | | | SrkToolit.WebForms | net40 | | | + +### v1.1 (support for net40 and MVC 4, net45 and MVC 5) + +Support for many .NET Framework and MVC4/MVC5. + +| Assembly | FX | Nuget | Remark | +|----------------------------------------------------------|------------------------------|-----------------------------------------------------------|--------| +| [SrkToolkit.Common](Wiki/SrkToolkit.Common.md) | net40, net45 | [nuget](https://www.nuget.org/packages/SrkToolkit.Common) | | +| SrkToolkit.Common.Unsafe | net40 | | | +| [SrkToolkit.Domain](Wiki/SrkToolkit.Domain.md) | net40, net45 | [nuget](https://www.nuget.org/packages/SrkToolkit.Domain) | | +| [SrkToolkit.Web (for ASP MVC 3)](Wiki/SrkToolkit.Web.md) | net40 | [nuget mvc4](https://www.nuget.org/packages/SrkToolkit.Web.AspMvc4) | | +| [SrkToolkit.Web (for ASP MVC 4)](Wiki/SrkToolkit.Web.md) | net45 | [nuget mvc5](https://www.nuget.org/packages/SrkToolkit.Web.AspMvc5) | | +| SrkToolkit.Domain.AspMvc3 | net40, | [nuget mvc4](https://www.nuget.org/packages/SrkToolkit.Domain.AspMvc4) | | +| SrkToolkit.Domain.AspMvc4 | net45 | [nuget mvc5](https://www.nuget.org/packages/SrkToolkit.Domain.AspMvc5) | | +| SrkToolit.WebForms | net40 | | | | SrkToolit.Xaml | net40, wp70, wp71, sl4 | | | | SrkToolkit.Mvvm | net40, wp70, wp71, sl4 | | | | SrkToolkit.Services | net40, wp70, wp71, sl4 | | | From a0a96464bd882b7c1426234916206f99ef3448ab Mon Sep 17 00:00:00 2001 From: SandRock Date: Fri, 10 Mar 2023 11:04:59 +0100 Subject: [PATCH 04/34] migrate code, comment non-migrated code... #20 --- Sources/SrkToolkit-v2.sln | 168 ----------- .../DecimalModelBinderTests.cs | 42 +-- .../IntegerModelBinderTests.cs | 28 +- .../OpenGraphNameTests.cs | 23 +- .../OpenGraphNamespaceTests.cs | 21 +- .../OpenGraphObjectTests.cs | 26 +- .../OpenGraphTagTests.cs | 13 +- .../PageInfoTests.cs | 19 +- .../SrkHtmlExtensionsTests.cs | 282 +++++++++--------- .../SrkHttpContextExtensionsTests.cs | 28 +- .../SrkMvcCollectionExtensionsTests.cs | 42 ++- .../SrkRequestExtensionsTests.cs | 45 ++- .../SrkToolkit.AspNetCore2.UnitTests.csproj | 18 ++ .../SrkUrlHelperExtensionsTests.cs | 115 ++++--- .../WebDependenciesTests.cs | 34 +-- .../System.Web.Mvc/SrkUrlHelperExtensions.cs | 2 - 16 files changed, 372 insertions(+), 534 deletions(-) diff --git a/Sources/SrkToolkit-v2.sln b/Sources/SrkToolkit-v2.sln index 5695f3f..9281f37 100644 --- a/Sources/SrkToolkit-v2.sln +++ b/Sources/SrkToolkit-v2.sln @@ -26,40 +26,16 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET4.SrkToolkit.Services", EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET4.SrkToolkit.Services.Tests", "NET4.SrkToolkit.Services.Tests\NET4.SrkToolkit.Services.Tests.csproj", "{7E6D5FC5-4ED0-433C-A92C-D4A0C0146CCB}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET4.SrkToolkit.Domain", "NET4.SrkToolkit.Domain\NET4.SrkToolkit.Domain.csproj", "{893A7FD4-62E6-4F7A-8FF9-EA502ADA88FA}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET4.SrkToolkit.Common", "NET4.SrkToolkit.Common\NET4.SrkToolkit.Common.csproj", "{19495A45-67A8-460D-806C-CF158B96BBE9}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET4.SrkToolkit.Common.Unsafe", "NET4.SrkToolkit.Common.Unsafe\NET4.SrkToolkit.Common.Unsafe.csproj", "{19727F77-249A-4AC9-859C-8441E5BD41C4}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET4.SrkToolkit.Common.Tests", "NET4.SrkToolkit.Common.Tests\NET4.SrkToolkit.Common.Tests.csproj", "{51E43E76-A342-42D3-A8AD-ABC45CEBD9C5}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET4.SrkToolkit.Domain.Tests", "NET4.SrkToolkit.Domain.Tests\NET4.SrkToolkit.Domain.Tests.csproj", "{80D861DB-FC7B-4DF7-8D87-750EEFC82B46}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET4.SrkToolkit.WebForms", "NET4.SrkToolkit.WebForms\NET4.SrkToolkit.WebForms.csproj", "{42AB07F9-CEB2-4A5B-A8FC-B7A85AD4DFD3}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET45.SrkToolkit.Common", "NET45.SrkToolkit.Common\NET45.SrkToolkit.Common.csproj", "{AD101432-1950-4F01-825A-7D108B30DA35}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET45.SrkToolkit.Domain", "NET45.SrkToolkit.Domain\NET45.SrkToolkit.Domain.csproj", "{50F8A9BC-CA87-48D0-BA18-32DF5F50A97A}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET45.SrkToolkit.Domain.AspMvc4", "NET45.SrkToolkit.Domain.AspMvc4\NET45.SrkToolkit.Domain.AspMvc4.csproj", "{0765606F-88B9-4682-80D3-64E612ADCB81}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET45.SrkToolkit.Web.Mvc4", "NET45.SrkToolkit.Web.Mvc4\NET45.SrkToolkit.Web.Mvc4.csproj", "{F60EC4EC-B969-4E8E-8E15-374BFACF99CF}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET45.SrkToolkit.Web.Mvc5", "NET45.SrkToolkit.Web.Mvc5\NET45.SrkToolkit.Web.Mvc5.csproj", "{55341205-ACB8-4E7D-8E39-0629AA8C2C32}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET45.SrkToolkit.Domain.AspMvc5", "NET45.SrkToolkit.Domain.AspMvc5\NET45.SrkToolkit.Domain.AspMvc5.csproj", "{F354D8B6-F293-45ED-AF9B-B746E1232C17}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET45.SrkToolkit.Common.Tests", "NET45.SrkToolkit.Common.Tests\NET45.SrkToolkit.Common.Tests.csproj", "{50AF7833-C345-4F6C-9FB1-36EB176D68E1}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NSTD.SrkToolkit.Common", "NSTD.SrkToolkit.Common\NSTD.SrkToolkit.Common.csproj", "{868FFFF9-365D-4F74-881D-68577D8D2BB0}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NSTD.SrkToolkit.Web", "NSTD.SrkToolkit.Web\NSTD.SrkToolkit.Web.csproj", "{D490BE59-2AC5-4816-AF5F-1BF89F46D680}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET45.SrkToolkit.Web.Tests", "NET4.SrkToolkit.Web.Tests\NET45.SrkToolkit.Web.Tests.csproj", "{80B716DA-2C58-4F77-8AC4-2F0180D44A39}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NSTD.SrkToolkit.Domain", "NSTD.SrkToolkit.Domain\NSTD.SrkToolkit.Domain.csproj", "{ED951C8A-9CD9-40B8-989F-E231A38EAF90}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SrkToolkit.Web.AspNetCore2", "SrkToolkit.Web.AspNetCore2\SrkToolkit.Web.AspNetCore2.csproj", "{38BDABA1-D402-45B7-ADEC-E36DC7D2E327}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SrkToolkit.AspNetCore2.UnitTests", "SrkToolkit.AspNetCore2.UnitTests\SrkToolkit.AspNetCore2.UnitTests.csproj", "{6697A04B-FCE0-479B-A11D-CACEAC2C56FC}" @@ -112,56 +88,6 @@ Global {7E6D5FC5-4ED0-433C-A92C-D4A0C0146CCB}.Release|ARM.ActiveCfg = Release|Any CPU {7E6D5FC5-4ED0-433C-A92C-D4A0C0146CCB}.Release|x64.ActiveCfg = Release|Any CPU {7E6D5FC5-4ED0-433C-A92C-D4A0C0146CCB}.Release|x86.ActiveCfg = Release|Any CPU - {893A7FD4-62E6-4F7A-8FF9-EA502ADA88FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {893A7FD4-62E6-4F7A-8FF9-EA502ADA88FA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {893A7FD4-62E6-4F7A-8FF9-EA502ADA88FA}.Debug|ARM.ActiveCfg = Debug|Any CPU - {893A7FD4-62E6-4F7A-8FF9-EA502ADA88FA}.Debug|x64.ActiveCfg = Debug|Any CPU - {893A7FD4-62E6-4F7A-8FF9-EA502ADA88FA}.Debug|x86.ActiveCfg = Debug|Any CPU - {893A7FD4-62E6-4F7A-8FF9-EA502ADA88FA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {893A7FD4-62E6-4F7A-8FF9-EA502ADA88FA}.Release|Any CPU.Build.0 = Release|Any CPU - {893A7FD4-62E6-4F7A-8FF9-EA502ADA88FA}.Release|ARM.ActiveCfg = Release|Any CPU - {893A7FD4-62E6-4F7A-8FF9-EA502ADA88FA}.Release|x64.ActiveCfg = Release|Any CPU - {893A7FD4-62E6-4F7A-8FF9-EA502ADA88FA}.Release|x86.ActiveCfg = Release|Any CPU - {19495A45-67A8-460D-806C-CF158B96BBE9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {19495A45-67A8-460D-806C-CF158B96BBE9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {19495A45-67A8-460D-806C-CF158B96BBE9}.Debug|ARM.ActiveCfg = Debug|Any CPU - {19495A45-67A8-460D-806C-CF158B96BBE9}.Debug|x64.ActiveCfg = Debug|Any CPU - {19495A45-67A8-460D-806C-CF158B96BBE9}.Debug|x86.ActiveCfg = Debug|Any CPU - {19495A45-67A8-460D-806C-CF158B96BBE9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {19495A45-67A8-460D-806C-CF158B96BBE9}.Release|Any CPU.Build.0 = Release|Any CPU - {19495A45-67A8-460D-806C-CF158B96BBE9}.Release|ARM.ActiveCfg = Release|Any CPU - {19495A45-67A8-460D-806C-CF158B96BBE9}.Release|x64.ActiveCfg = Release|Any CPU - {19495A45-67A8-460D-806C-CF158B96BBE9}.Release|x86.ActiveCfg = Release|Any CPU - {19727F77-249A-4AC9-859C-8441E5BD41C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {19727F77-249A-4AC9-859C-8441E5BD41C4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {19727F77-249A-4AC9-859C-8441E5BD41C4}.Debug|ARM.ActiveCfg = Debug|Any CPU - {19727F77-249A-4AC9-859C-8441E5BD41C4}.Debug|x64.ActiveCfg = Debug|Any CPU - {19727F77-249A-4AC9-859C-8441E5BD41C4}.Debug|x86.ActiveCfg = Debug|Any CPU - {19727F77-249A-4AC9-859C-8441E5BD41C4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {19727F77-249A-4AC9-859C-8441E5BD41C4}.Release|Any CPU.Build.0 = Release|Any CPU - {19727F77-249A-4AC9-859C-8441E5BD41C4}.Release|ARM.ActiveCfg = Release|Any CPU - {19727F77-249A-4AC9-859C-8441E5BD41C4}.Release|x64.ActiveCfg = Release|Any CPU - {19727F77-249A-4AC9-859C-8441E5BD41C4}.Release|x86.ActiveCfg = Release|Any CPU - {51E43E76-A342-42D3-A8AD-ABC45CEBD9C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {51E43E76-A342-42D3-A8AD-ABC45CEBD9C5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {51E43E76-A342-42D3-A8AD-ABC45CEBD9C5}.Debug|ARM.ActiveCfg = Debug|Any CPU - {51E43E76-A342-42D3-A8AD-ABC45CEBD9C5}.Debug|x64.ActiveCfg = Debug|Any CPU - {51E43E76-A342-42D3-A8AD-ABC45CEBD9C5}.Debug|x86.ActiveCfg = Debug|Any CPU - {51E43E76-A342-42D3-A8AD-ABC45CEBD9C5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {51E43E76-A342-42D3-A8AD-ABC45CEBD9C5}.Release|Any CPU.Build.0 = Release|Any CPU - {51E43E76-A342-42D3-A8AD-ABC45CEBD9C5}.Release|ARM.ActiveCfg = Release|Any CPU - {51E43E76-A342-42D3-A8AD-ABC45CEBD9C5}.Release|x64.ActiveCfg = Release|Any CPU - {51E43E76-A342-42D3-A8AD-ABC45CEBD9C5}.Release|x86.ActiveCfg = Release|Any CPU - {80D861DB-FC7B-4DF7-8D87-750EEFC82B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {80D861DB-FC7B-4DF7-8D87-750EEFC82B46}.Debug|Any CPU.Build.0 = Debug|Any CPU - {80D861DB-FC7B-4DF7-8D87-750EEFC82B46}.Debug|ARM.ActiveCfg = Debug|Any CPU - {80D861DB-FC7B-4DF7-8D87-750EEFC82B46}.Debug|x64.ActiveCfg = Debug|Any CPU - {80D861DB-FC7B-4DF7-8D87-750EEFC82B46}.Debug|x86.ActiveCfg = Debug|Any CPU - {80D861DB-FC7B-4DF7-8D87-750EEFC82B46}.Release|Any CPU.ActiveCfg = Release|Any CPU - {80D861DB-FC7B-4DF7-8D87-750EEFC82B46}.Release|Any CPU.Build.0 = Release|Any CPU - {80D861DB-FC7B-4DF7-8D87-750EEFC82B46}.Release|ARM.ActiveCfg = Release|Any CPU - {80D861DB-FC7B-4DF7-8D87-750EEFC82B46}.Release|x64.ActiveCfg = Release|Any CPU - {80D861DB-FC7B-4DF7-8D87-750EEFC82B46}.Release|x86.ActiveCfg = Release|Any CPU {42AB07F9-CEB2-4A5B-A8FC-B7A85AD4DFD3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {42AB07F9-CEB2-4A5B-A8FC-B7A85AD4DFD3}.Debug|Any CPU.Build.0 = Debug|Any CPU {42AB07F9-CEB2-4A5B-A8FC-B7A85AD4DFD3}.Debug|ARM.ActiveCfg = Debug|Any CPU @@ -172,36 +98,6 @@ Global {42AB07F9-CEB2-4A5B-A8FC-B7A85AD4DFD3}.Release|ARM.ActiveCfg = Release|Any CPU {42AB07F9-CEB2-4A5B-A8FC-B7A85AD4DFD3}.Release|x64.ActiveCfg = Release|Any CPU {42AB07F9-CEB2-4A5B-A8FC-B7A85AD4DFD3}.Release|x86.ActiveCfg = Release|Any CPU - {AD101432-1950-4F01-825A-7D108B30DA35}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AD101432-1950-4F01-825A-7D108B30DA35}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AD101432-1950-4F01-825A-7D108B30DA35}.Debug|ARM.ActiveCfg = Debug|Any CPU - {AD101432-1950-4F01-825A-7D108B30DA35}.Debug|x64.ActiveCfg = Debug|Any CPU - {AD101432-1950-4F01-825A-7D108B30DA35}.Debug|x86.ActiveCfg = Debug|Any CPU - {AD101432-1950-4F01-825A-7D108B30DA35}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AD101432-1950-4F01-825A-7D108B30DA35}.Release|Any CPU.Build.0 = Release|Any CPU - {AD101432-1950-4F01-825A-7D108B30DA35}.Release|ARM.ActiveCfg = Release|Any CPU - {AD101432-1950-4F01-825A-7D108B30DA35}.Release|x64.ActiveCfg = Release|Any CPU - {AD101432-1950-4F01-825A-7D108B30DA35}.Release|x86.ActiveCfg = Release|Any CPU - {50F8A9BC-CA87-48D0-BA18-32DF5F50A97A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {50F8A9BC-CA87-48D0-BA18-32DF5F50A97A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {50F8A9BC-CA87-48D0-BA18-32DF5F50A97A}.Debug|ARM.ActiveCfg = Debug|Any CPU - {50F8A9BC-CA87-48D0-BA18-32DF5F50A97A}.Debug|x64.ActiveCfg = Debug|Any CPU - {50F8A9BC-CA87-48D0-BA18-32DF5F50A97A}.Debug|x86.ActiveCfg = Debug|Any CPU - {50F8A9BC-CA87-48D0-BA18-32DF5F50A97A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {50F8A9BC-CA87-48D0-BA18-32DF5F50A97A}.Release|Any CPU.Build.0 = Release|Any CPU - {50F8A9BC-CA87-48D0-BA18-32DF5F50A97A}.Release|ARM.ActiveCfg = Release|Any CPU - {50F8A9BC-CA87-48D0-BA18-32DF5F50A97A}.Release|x64.ActiveCfg = Release|Any CPU - {50F8A9BC-CA87-48D0-BA18-32DF5F50A97A}.Release|x86.ActiveCfg = Release|Any CPU - {0765606F-88B9-4682-80D3-64E612ADCB81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0765606F-88B9-4682-80D3-64E612ADCB81}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0765606F-88B9-4682-80D3-64E612ADCB81}.Debug|ARM.ActiveCfg = Debug|Any CPU - {0765606F-88B9-4682-80D3-64E612ADCB81}.Debug|x64.ActiveCfg = Debug|Any CPU - {0765606F-88B9-4682-80D3-64E612ADCB81}.Debug|x86.ActiveCfg = Debug|Any CPU - {0765606F-88B9-4682-80D3-64E612ADCB81}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0765606F-88B9-4682-80D3-64E612ADCB81}.Release|Any CPU.Build.0 = Release|Any CPU - {0765606F-88B9-4682-80D3-64E612ADCB81}.Release|ARM.ActiveCfg = Release|Any CPU - {0765606F-88B9-4682-80D3-64E612ADCB81}.Release|x64.ActiveCfg = Release|Any CPU - {0765606F-88B9-4682-80D3-64E612ADCB81}.Release|x86.ActiveCfg = Release|Any CPU {F60EC4EC-B969-4E8E-8E15-374BFACF99CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F60EC4EC-B969-4E8E-8E15-374BFACF99CF}.Debug|Any CPU.Build.0 = Debug|Any CPU {F60EC4EC-B969-4E8E-8E15-374BFACF99CF}.Debug|ARM.ActiveCfg = Debug|Any CPU @@ -222,42 +118,6 @@ Global {55341205-ACB8-4E7D-8E39-0629AA8C2C32}.Release|ARM.ActiveCfg = Release|Any CPU {55341205-ACB8-4E7D-8E39-0629AA8C2C32}.Release|x64.ActiveCfg = Release|Any CPU {55341205-ACB8-4E7D-8E39-0629AA8C2C32}.Release|x86.ActiveCfg = Release|Any CPU - {F354D8B6-F293-45ED-AF9B-B746E1232C17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F354D8B6-F293-45ED-AF9B-B746E1232C17}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F354D8B6-F293-45ED-AF9B-B746E1232C17}.Debug|ARM.ActiveCfg = Debug|Any CPU - {F354D8B6-F293-45ED-AF9B-B746E1232C17}.Debug|x64.ActiveCfg = Debug|Any CPU - {F354D8B6-F293-45ED-AF9B-B746E1232C17}.Debug|x86.ActiveCfg = Debug|Any CPU - {F354D8B6-F293-45ED-AF9B-B746E1232C17}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F354D8B6-F293-45ED-AF9B-B746E1232C17}.Release|Any CPU.Build.0 = Release|Any CPU - {F354D8B6-F293-45ED-AF9B-B746E1232C17}.Release|ARM.ActiveCfg = Release|Any CPU - {F354D8B6-F293-45ED-AF9B-B746E1232C17}.Release|x64.ActiveCfg = Release|Any CPU - {F354D8B6-F293-45ED-AF9B-B746E1232C17}.Release|x86.ActiveCfg = Release|Any CPU - {50AF7833-C345-4F6C-9FB1-36EB176D68E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {50AF7833-C345-4F6C-9FB1-36EB176D68E1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {50AF7833-C345-4F6C-9FB1-36EB176D68E1}.Debug|ARM.ActiveCfg = Debug|Any CPU - {50AF7833-C345-4F6C-9FB1-36EB176D68E1}.Debug|x64.ActiveCfg = Debug|Any CPU - {50AF7833-C345-4F6C-9FB1-36EB176D68E1}.Debug|x86.ActiveCfg = Debug|Any CPU - {50AF7833-C345-4F6C-9FB1-36EB176D68E1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {50AF7833-C345-4F6C-9FB1-36EB176D68E1}.Release|Any CPU.Build.0 = Release|Any CPU - {50AF7833-C345-4F6C-9FB1-36EB176D68E1}.Release|ARM.ActiveCfg = Release|Any CPU - {50AF7833-C345-4F6C-9FB1-36EB176D68E1}.Release|x64.ActiveCfg = Release|Any CPU - {50AF7833-C345-4F6C-9FB1-36EB176D68E1}.Release|x86.ActiveCfg = Release|Any CPU - {868FFFF9-365D-4F74-881D-68577D8D2BB0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {868FFFF9-365D-4F74-881D-68577D8D2BB0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {868FFFF9-365D-4F74-881D-68577D8D2BB0}.Debug|ARM.ActiveCfg = Debug|Any CPU - {868FFFF9-365D-4F74-881D-68577D8D2BB0}.Debug|ARM.Build.0 = Debug|Any CPU - {868FFFF9-365D-4F74-881D-68577D8D2BB0}.Debug|x64.ActiveCfg = Debug|Any CPU - {868FFFF9-365D-4F74-881D-68577D8D2BB0}.Debug|x64.Build.0 = Debug|Any CPU - {868FFFF9-365D-4F74-881D-68577D8D2BB0}.Debug|x86.ActiveCfg = Debug|Any CPU - {868FFFF9-365D-4F74-881D-68577D8D2BB0}.Debug|x86.Build.0 = Debug|Any CPU - {868FFFF9-365D-4F74-881D-68577D8D2BB0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {868FFFF9-365D-4F74-881D-68577D8D2BB0}.Release|Any CPU.Build.0 = Release|Any CPU - {868FFFF9-365D-4F74-881D-68577D8D2BB0}.Release|ARM.ActiveCfg = Release|Any CPU - {868FFFF9-365D-4F74-881D-68577D8D2BB0}.Release|ARM.Build.0 = Release|Any CPU - {868FFFF9-365D-4F74-881D-68577D8D2BB0}.Release|x64.ActiveCfg = Release|Any CPU - {868FFFF9-365D-4F74-881D-68577D8D2BB0}.Release|x64.Build.0 = Release|Any CPU - {868FFFF9-365D-4F74-881D-68577D8D2BB0}.Release|x86.ActiveCfg = Release|Any CPU - {868FFFF9-365D-4F74-881D-68577D8D2BB0}.Release|x86.Build.0 = Release|Any CPU {D490BE59-2AC5-4816-AF5F-1BF89F46D680}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D490BE59-2AC5-4816-AF5F-1BF89F46D680}.Debug|Any CPU.Build.0 = Debug|Any CPU {D490BE59-2AC5-4816-AF5F-1BF89F46D680}.Debug|ARM.ActiveCfg = Debug|Any CPU @@ -290,22 +150,6 @@ Global {80B716DA-2C58-4F77-8AC4-2F0180D44A39}.Release|x64.Build.0 = Release|Any CPU {80B716DA-2C58-4F77-8AC4-2F0180D44A39}.Release|x86.ActiveCfg = Release|Any CPU {80B716DA-2C58-4F77-8AC4-2F0180D44A39}.Release|x86.Build.0 = Release|Any CPU - {ED951C8A-9CD9-40B8-989F-E231A38EAF90}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {ED951C8A-9CD9-40B8-989F-E231A38EAF90}.Debug|Any CPU.Build.0 = Debug|Any CPU - {ED951C8A-9CD9-40B8-989F-E231A38EAF90}.Debug|ARM.ActiveCfg = Debug|Any CPU - {ED951C8A-9CD9-40B8-989F-E231A38EAF90}.Debug|ARM.Build.0 = Debug|Any CPU - {ED951C8A-9CD9-40B8-989F-E231A38EAF90}.Debug|x64.ActiveCfg = Debug|Any CPU - {ED951C8A-9CD9-40B8-989F-E231A38EAF90}.Debug|x64.Build.0 = Debug|Any CPU - {ED951C8A-9CD9-40B8-989F-E231A38EAF90}.Debug|x86.ActiveCfg = Debug|Any CPU - {ED951C8A-9CD9-40B8-989F-E231A38EAF90}.Debug|x86.Build.0 = Debug|Any CPU - {ED951C8A-9CD9-40B8-989F-E231A38EAF90}.Release|Any CPU.ActiveCfg = Release|Any CPU - {ED951C8A-9CD9-40B8-989F-E231A38EAF90}.Release|Any CPU.Build.0 = Release|Any CPU - {ED951C8A-9CD9-40B8-989F-E231A38EAF90}.Release|ARM.ActiveCfg = Release|Any CPU - {ED951C8A-9CD9-40B8-989F-E231A38EAF90}.Release|ARM.Build.0 = Release|Any CPU - {ED951C8A-9CD9-40B8-989F-E231A38EAF90}.Release|x64.ActiveCfg = Release|Any CPU - {ED951C8A-9CD9-40B8-989F-E231A38EAF90}.Release|x64.Build.0 = Release|Any CPU - {ED951C8A-9CD9-40B8-989F-E231A38EAF90}.Release|x86.ActiveCfg = Release|Any CPU - {ED951C8A-9CD9-40B8-989F-E231A38EAF90}.Release|x86.Build.0 = Release|Any CPU {38BDABA1-D402-45B7-ADEC-E36DC7D2E327}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {38BDABA1-D402-45B7-ADEC-E36DC7D2E327}.Debug|Any CPU.Build.0 = Debug|Any CPU {38BDABA1-D402-45B7-ADEC-E36DC7D2E327}.Debug|ARM.ActiveCfg = Debug|Any CPU @@ -457,23 +301,11 @@ Global GlobalSection(NestedProjects) = preSolution {CFDFCEA2-BAFB-455E-BEF4-40343DE968CF} = {B70211DF-4DB4-4D29-842C-1CE527BD1EFC} {7E6D5FC5-4ED0-433C-A92C-D4A0C0146CCB} = {B70211DF-4DB4-4D29-842C-1CE527BD1EFC} - {893A7FD4-62E6-4F7A-8FF9-EA502ADA88FA} = {559DC157-DDC9-44BA-B25D-0A18E286D1CC} - {19495A45-67A8-460D-806C-CF158B96BBE9} = {C3406DF1-E92C-4100-BEF9-B49F616E77C5} - {19727F77-249A-4AC9-859C-8441E5BD41C4} = {C3406DF1-E92C-4100-BEF9-B49F616E77C5} - {51E43E76-A342-42D3-A8AD-ABC45CEBD9C5} = {C3406DF1-E92C-4100-BEF9-B49F616E77C5} - {80D861DB-FC7B-4DF7-8D87-750EEFC82B46} = {559DC157-DDC9-44BA-B25D-0A18E286D1CC} {42AB07F9-CEB2-4A5B-A8FC-B7A85AD4DFD3} = {B9ACA570-A4AC-4AC9-95E2-A95BCEDBD866} - {AD101432-1950-4F01-825A-7D108B30DA35} = {C3406DF1-E92C-4100-BEF9-B49F616E77C5} - {50F8A9BC-CA87-48D0-BA18-32DF5F50A97A} = {559DC157-DDC9-44BA-B25D-0A18E286D1CC} - {0765606F-88B9-4682-80D3-64E612ADCB81} = {559DC157-DDC9-44BA-B25D-0A18E286D1CC} {F60EC4EC-B969-4E8E-8E15-374BFACF99CF} = {B9ACA570-A4AC-4AC9-95E2-A95BCEDBD866} {55341205-ACB8-4E7D-8E39-0629AA8C2C32} = {B9ACA570-A4AC-4AC9-95E2-A95BCEDBD866} - {F354D8B6-F293-45ED-AF9B-B746E1232C17} = {559DC157-DDC9-44BA-B25D-0A18E286D1CC} - {50AF7833-C345-4F6C-9FB1-36EB176D68E1} = {C3406DF1-E92C-4100-BEF9-B49F616E77C5} - {868FFFF9-365D-4F74-881D-68577D8D2BB0} = {C3406DF1-E92C-4100-BEF9-B49F616E77C5} {D490BE59-2AC5-4816-AF5F-1BF89F46D680} = {B9ACA570-A4AC-4AC9-95E2-A95BCEDBD866} {80B716DA-2C58-4F77-8AC4-2F0180D44A39} = {B9ACA570-A4AC-4AC9-95E2-A95BCEDBD866} - {ED951C8A-9CD9-40B8-989F-E231A38EAF90} = {559DC157-DDC9-44BA-B25D-0A18E286D1CC} {1C28C6A0-23B2-43ED-B62C-C586F2976473} = {B9ACA570-A4AC-4AC9-95E2-A95BCEDBD866} {9442B344-FC0D-4A0B-BE0E-D317C72F2A8E} = {C3406DF1-E92C-4100-BEF9-B49F616E77C5} {00457CE3-FE08-4AF2-972E-4C2EDD36F38D} = {C3406DF1-E92C-4100-BEF9-B49F616E77C5} diff --git a/Sources/SrkToolkit.AspNetCore2.UnitTests/DecimalModelBinderTests.cs b/Sources/SrkToolkit.AspNetCore2.UnitTests/DecimalModelBinderTests.cs index 0661b0f..e18bc0c 100644 --- a/Sources/SrkToolkit.AspNetCore2.UnitTests/DecimalModelBinderTests.cs +++ b/Sources/SrkToolkit.AspNetCore2.UnitTests/DecimalModelBinderTests.cs @@ -16,12 +16,14 @@ namespace SrkToolkit.Web.Tests { + using Microsoft.AspNetCore.Mvc.ModelBinding; + using Microsoft.AspNetCore.Mvc.ModelBinding.Binders; + using SrkToolkit.Web.Mvc; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Globalization; - using SrkToolkit.Web.Mvc; using Xunit; public class DecimalModelBinderTests @@ -88,7 +90,7 @@ public void DoubleNotFrenchStyle() object value; var valueProvider = new ValueProviderResult(expectation.Input, expectation.Input, expectation.Culture); var result = target.BindModelImpl(valueProvider, out value); - Assert.AreEqual(expectation.Expected, value, "In: '" + expectation.Input + "' " + expectation.Culture.Name); + Assert.Equal(expectation.Expected, value, "In: '" + expectation.Input + "' " + expectation.Culture.Name); } } @@ -101,7 +103,7 @@ public void DoubleIsFrenchStyle() object value; var valueProvider = new ValueProviderResult(expectation.Input, expectation.Input, expectation.Culture); var result = target.BindModelImpl(valueProvider, out value); - Assert.AreEqual(expectation.Expected, value, "In: '" + expectation.Input + "' " + expectation.Culture.Name); + Assert.Equal(expectation.Expected, value, "In: '" + expectation.Input + "' " + expectation.Culture.Name); } } @@ -117,8 +119,8 @@ public void DoubleBug1() object value; var valueProvider = new ValueProviderResult(input, input, culture); var result = target.BindModelImpl(valueProvider, out value); - Assert.AreEqual(expected, value); - Assert.AreEqual(0, result.Errors.Count); + Assert.Equal(expected, value); + Assert.Equal(0, result.Errors.Count); } [Fact] @@ -133,7 +135,7 @@ public void DoubleNotNullable() object value; var valueProvider = new ValueProviderResult(input, input, culture); var result = target.BindModelImpl(valueProvider, out value); - Assert.AreEqual(1, result.Errors.Count); + Assert.Equal(1, result.Errors.Count); } [Fact] @@ -148,8 +150,8 @@ public void DoubleIsNullable() object value; var valueProvider = new ValueProviderResult(input, input, culture); var result = target.BindModelImpl(valueProvider, out value); - Assert.AreEqual(expected, value); - Assert.AreEqual(0, result.Errors.Count); + Assert.Equal(expected, value); + Assert.Equal(0, result.Errors.Count); } [Fact] @@ -162,7 +164,7 @@ public void DecimalNotFrenchStyle() object value; var valueProvider = new ValueProviderResult(expectation.Input, expectation.Input, expectation.Culture); var result = target.BindModelImpl(valueProvider, out value); - Assert.AreEqual(expectedValue, value, "In: '" + expectation.Input + "' " + expectation.Culture.Name); + Assert.Equal(expectedValue, value, "In: '" + expectation.Input + "' " + expectation.Culture.Name); } } @@ -176,7 +178,7 @@ public void DecimalIsFrenchStyle() object value; var valueProvider = new ValueProviderResult(expectation.Input, expectation.Input, expectation.Culture); var result = target.BindModelImpl(valueProvider, out value); - Assert.AreEqual(expectedValue, value, "In: '" + expectation.Input + "' " + expectation.Culture.Name); + Assert.Equal(expectedValue, value, "In: '" + expectation.Input + "' " + expectation.Culture.Name); } } @@ -192,8 +194,8 @@ public void DecimalBug1() object value; var valueProvider = new ValueProviderResult(input, input, culture); var result = target.BindModelImpl(valueProvider, out value); - Assert.AreEqual(expected, value); - Assert.AreEqual(0, result.Errors.Count); + Assert.Equal(expected, value); + Assert.Equal(0, result.Errors.Count); } [Fact] @@ -208,7 +210,7 @@ public void DecimalNotNullable() object value; var valueProvider = new ValueProviderResult(input, input, culture); var result = target.BindModelImpl(valueProvider, out value); - Assert.AreEqual(1, result.Errors.Count); + Assert.Equal(1, result.Errors.Count); } [Fact] @@ -223,8 +225,8 @@ public void DecimalIsNullable() object value; var valueProvider = new ValueProviderResult(input, input, culture); var result = target.BindModelImpl(valueProvider, out value); - Assert.AreEqual(expected, value); - Assert.AreEqual(0, result.Errors.Count); + Assert.Equal(expected, value); + Assert.Equal(0, result.Errors.Count); } [Fact] @@ -239,8 +241,8 @@ public void DecimalIsNullableNull() object value; var valueProvider = new ValueProviderResult(input, input, culture); var result = target.BindModelImpl(null, out value); - Assert.AreEqual(expected, value); - Assert.AreEqual(0, result.Errors.Count); + Assert.Equal(expected, value); + Assert.Equal(0, result.Errors.Count); } [Fact] @@ -254,8 +256,8 @@ public void Bug1() object value; var valueProvider = new ValueProviderResult(input, input, culture); var result = target.BindModelImpl(valueProvider, out value); - Assert.AreEqual(expected, value); - Assert.AreEqual(0, result.Errors.Count); + Assert.Equal(expected, value); + Assert.Equal(0, result.Errors.Count); } } @@ -266,7 +268,7 @@ public void Works() { var binders = new ModelBinderDictionary(); DecimalModelBinder.Register(binders); - Assert.AreEqual(6, binders.Count); + Assert.Equal(6, binders.Count); } } diff --git a/Sources/SrkToolkit.AspNetCore2.UnitTests/IntegerModelBinderTests.cs b/Sources/SrkToolkit.AspNetCore2.UnitTests/IntegerModelBinderTests.cs index e261fba..464dc67 100644 --- a/Sources/SrkToolkit.AspNetCore2.UnitTests/IntegerModelBinderTests.cs +++ b/Sources/SrkToolkit.AspNetCore2.UnitTests/IntegerModelBinderTests.cs @@ -17,18 +17,19 @@ #if DEBUG namespace SrkToolkit.Web.Tests { + using Microsoft.AspNetCore.Mvc.ModelBinding; + using Microsoft.AspNetCore.Mvc.ModelBinding.Binders; + using SrkToolkit.Web.Mvc; using System; using System.Collections.Generic; using System.Linq; using System.Text; - using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Globalization; - using SrkToolkit.Web.Mvc; using System.Web.Mvc; + using Xunit; public class IntegerModelBinderTests { - [TestClass] public class ConvertFrenchStyleDecimals { static List> intExpectations; @@ -47,7 +48,7 @@ public static CultureInfo C(string name) return new CultureInfo(name); } - [TestMethod] + [Fact] public void IntegerExpectations() { var target = new IntegerModelBinder(); @@ -56,11 +57,11 @@ public void IntegerExpectations() object value; var valueProvider = new ValueProviderResult(expectation.Input, expectation.Input, expectation.Culture); var result = target.BindModelImpl(valueProvider, out value); - Assert.AreEqual(expectation.Expected, value, "In: '" + expectation.Input + "' " + expectation.Culture.Name); + Assert.Equal(expectation.Expected, value, "In: '" + expectation.Input + "' " + expectation.Culture.Name); } } - [TestMethod] + [Fact] public void IntNotNullable() { // typical bug we don't want to see @@ -72,10 +73,10 @@ public void IntNotNullable() object value; var valueProvider = new ValueProviderResult(input, input, culture); var result = target.BindModelImpl(valueProvider, out value); - Assert.AreEqual(1, result.Errors.Count); + Assert.Equal(1, result.Errors.Count); } - [TestMethod] + [Fact] public void IntIsNullable() { // typical bug we don't want to see @@ -87,21 +88,20 @@ public void IntIsNullable() object value; var valueProvider = new ValueProviderResult(input, input, culture); var result = target.BindModelImpl(valueProvider, out value); - Assert.AreEqual(expected, value); - Assert.AreEqual(0, result.Errors.Count); + Assert.Equal(expected, value); + Assert.Equal(0, result.Errors.Count); } } - [TestClass] public class RegisterMethod { - [TestMethod] + [Fact] public void Works() { var binders = new ModelBinderDictionary(); IntegerModelBinder.Register(binders); - Assert.AreEqual(14, binders.Count); - Assert.IsTrue(binders.All(b => b.Value.GetType().Name == "IntegerModelBinder`1")); + Assert.Equal(14, binders.Count); + Assert.True(binders.All(b => b.Value.GetType().Name == "IntegerModelBinder`1")); } } diff --git a/Sources/SrkToolkit.AspNetCore2.UnitTests/OpenGraphNameTests.cs b/Sources/SrkToolkit.AspNetCore2.UnitTests/OpenGraphNameTests.cs index dab5281..f6461aa 100644 --- a/Sources/SrkToolkit.AspNetCore2.UnitTests/OpenGraphNameTests.cs +++ b/Sources/SrkToolkit.AspNetCore2.UnitTests/OpenGraphNameTests.cs @@ -16,43 +16,42 @@ namespace SrkToolkit.Web.Tests { + using SrkToolkit.Web.Open; using System; using System.Collections.Generic; using System.Linq; using System.Text; - using Microsoft.VisualStudio.TestTools.UnitTesting; - using SrkToolkit.Web.Open; + using Xunit; - [TestClass] public class OpenGraphNameTests { - [TestMethod] + [Fact] public void HasDefinedNameAndNamespace() { var name = "toto"; var nsName = "super"; var ns = new OpenGraphNamespace(nsName, "a"); var obj = new OpenGraphName(ns, name); - Assert.AreEqual(nsName, obj.NamespaceName); - Assert.AreEqual(name, obj.Name); + Assert.Equal(nsName, obj.NamespaceName); + Assert.Equal(name, obj.Name); } - ////[TestMethod] + ////[Fact] ////public void StringImplicitOperatorGivesOgNamespaceName() ////{ //// var name = "toto"; //// OpenGraphName obj = name; - //// Assert.AreEqual("og", obj.NamespaceName); - //// Assert.AreEqual(name, obj.Name); + //// Assert.Equal("og", obj.NamespaceName); + //// Assert.Equal(name, obj.Name); ////} - [TestMethod] + [Fact] public void NameCtorGivesOgNamespaceName() { var name = "toto"; OpenGraphName obj = new OpenGraphName(name); - Assert.AreEqual("og", obj.NamespaceName); - Assert.AreEqual(name, obj.Name); + Assert.Equal("og", obj.NamespaceName); + Assert.Equal(name, obj.Name); } } } diff --git a/Sources/SrkToolkit.AspNetCore2.UnitTests/OpenGraphNamespaceTests.cs b/Sources/SrkToolkit.AspNetCore2.UnitTests/OpenGraphNamespaceTests.cs index bdbc43c..f50785c 100644 --- a/Sources/SrkToolkit.AspNetCore2.UnitTests/OpenGraphNamespaceTests.cs +++ b/Sources/SrkToolkit.AspNetCore2.UnitTests/OpenGraphNamespaceTests.cs @@ -16,47 +16,46 @@ namespace SrkToolkit.Web.Tests { + using SrkToolkit.Web.Open; using System; using System.Collections.Generic; using System.Linq; using System.Text; - using Microsoft.VisualStudio.TestTools.UnitTesting; - using SrkToolkit.Web.Open; + using Xunit; - [TestClass] public class OpenGraphNamespaceTests { - [TestMethod] + [Fact] public void HasDefinedName() { var nsName = "test"; var ns = new OpenGraphNamespace(nsName, "http://nsname/"); - Assert.AreEqual(nsName, ns.Name); + Assert.Equal(nsName, ns.Name); } - ////[TestMethod] + ////[Fact] ////public void ImplicitOperatorHasDefinedName() ////{ //// var nsName = "test"; //// OpenGraphNamespace ns = nsName; - //// Assert.AreEqual(nsName, ns.Name); + //// Assert.Equal(nsName, ns.Name); ////} - [TestMethod] + [Fact] public void CustomRendersHtmlAttribute() { var nsName = "test"; var ns = new OpenGraphNamespace(nsName, "http://myns.me/test"); var expected = " xmlns:test=\"http://myns.me/test\" "; - Assert.AreEqual(expected, ns.ToHtmlAttributeString()); + Assert.Equal(expected, ns.ToHtmlAttributeString()); } - [TestMethod] + [Fact] public void DefaultRendersHtmlAttribute() { var name = new OpenGraphName("test"); var expected = " xmlns:og=\"http://ogp.me/ns#\" "; - Assert.AreEqual(expected, name.Namespace.ToHtmlAttributeString()); + Assert.Equal(expected, name.Namespace.ToHtmlAttributeString()); } } } diff --git a/Sources/SrkToolkit.AspNetCore2.UnitTests/OpenGraphObjectTests.cs b/Sources/SrkToolkit.AspNetCore2.UnitTests/OpenGraphObjectTests.cs index 5766084..40930aa 100644 --- a/Sources/SrkToolkit.AspNetCore2.UnitTests/OpenGraphObjectTests.cs +++ b/Sources/SrkToolkit.AspNetCore2.UnitTests/OpenGraphObjectTests.cs @@ -16,50 +16,48 @@ namespace SrkToolkit.Web.Tests { + using SrkToolkit.Web.Open; using System; using System.Collections.Generic; using System.Linq; using System.Text; - using Microsoft.VisualStudio.TestTools.UnitTesting; - using SrkToolkit.Web.Open; - using System.Web; + using Xunit; - [TestClass] public class OpenGraphObjectTests { - [TestMethod] + [Fact] public void EmptyObjectRendersNothing() { var obj = new OpenGraphObject(); - Assert.AreEqual(string.Empty, obj.ToString()); + Assert.Equal(string.Empty, obj.ToString()); } - [TestMethod] + [Fact] public void BasicObjectRendersTags() { var obj = new OpenGraphObject("my super title", new Uri("http://test.org/my-super-title")); var expected = Meta("og:title", "my super title") + Meta("og:url", "http://test.org/my-super-title"); - Assert.AreEqual(expected, obj.ToString()); + Assert.Equal(expected, obj.ToString()); } - [TestMethod] + [Fact] public void BasicObjectRendersNamespaces() { var obj = new OpenGraphObject("my super title", new Uri("http://test.org/my-super-title")); var expected = " xmlns:og=\"http://ogp.me/ns#\" "; - Assert.AreEqual(expected, obj.ToHtmlAttributeNamespaces()); + Assert.Equal(expected, obj.ToHtmlAttributeNamespaces()); } - [TestMethod] + [Fact] public void RendersMultipleNamespaces() { var obj = new OpenGraphObject("my super title", new Uri("http://test.org/my-super-title")); obj.Add(new OpenGraphTag(new OpenGraphName("key", "xxx", "http://xxx/aaa/#"), "value")); var expected = " xmlns:og=\"http://ogp.me/ns#\" xmlns:xxx=\"http://xxx/aaa/#\" "; - Assert.AreEqual(expected, obj.ToHtmlAttributeNamespaces()); + Assert.Equal(expected, obj.ToHtmlAttributeNamespaces()); } - [TestMethod] + [Fact] public void TypicalHomepageWithLogo() { var obj = new OpenGraphObject("welcome to mysite", new Uri("http://mysite.com/")); @@ -69,7 +67,7 @@ public void TypicalHomepageWithLogo() + Meta("og:url", "http://mysite.com/") + Meta("og:image", "http://mysite.com/Content/loog.png") + Meta("og:description", "With mysite, build your blog in 2 minutes"); - Assert.AreEqual(expected, obj.ToString()); + Assert.Equal(expected, obj.ToString()); } private string Meta(string key, string value) diff --git a/Sources/SrkToolkit.AspNetCore2.UnitTests/OpenGraphTagTests.cs b/Sources/SrkToolkit.AspNetCore2.UnitTests/OpenGraphTagTests.cs index c55614a..8f1cefa 100644 --- a/Sources/SrkToolkit.AspNetCore2.UnitTests/OpenGraphTagTests.cs +++ b/Sources/SrkToolkit.AspNetCore2.UnitTests/OpenGraphTagTests.cs @@ -16,30 +16,29 @@ namespace SrkToolkit.Web.Tests { + using SrkToolkit.Web.Open; using System; using System.Collections.Generic; using System.Linq; using System.Text; - using Microsoft.VisualStudio.TestTools.UnitTesting; - using SrkToolkit.Web.Open; + using Xunit; - [TestClass] public class OpenGraphTagTests { - [TestMethod] + [Fact] public void ToStringFormatsHtmlTag() { var tag = new OpenGraphTag(new OpenGraphName(new OpenGraphNamespace("ns", "http://ns/"), "key"), "value"); var expected = ""; - Assert.AreEqual(expected, tag.ToString()); + Assert.Equal(expected, tag.ToString()); } - [TestMethod] + [Fact] public void ToStringFormatsEscapedHtmlTag() { var tag = new OpenGraphTag(new OpenGraphName(new OpenGraphNamespace("", "http://ns/"), ""), ""); var expected = ""; - Assert.AreEqual(expected, tag.ToString()); + Assert.Equal(expected, tag.ToString()); } } } diff --git a/Sources/SrkToolkit.AspNetCore2.UnitTests/PageInfoTests.cs b/Sources/SrkToolkit.AspNetCore2.UnitTests/PageInfoTests.cs index af942a4..3db830a 100644 --- a/Sources/SrkToolkit.AspNetCore2.UnitTests/PageInfoTests.cs +++ b/Sources/SrkToolkit.AspNetCore2.UnitTests/PageInfoTests.cs @@ -16,7 +16,6 @@ namespace SrkToolkit.Web.Tests { - using Microsoft.VisualStudio.TestTools.UnitTesting; using SrkToolkit.Web.Open; using System; using System.Collections.Generic; @@ -24,11 +23,11 @@ namespace SrkToolkit.Web.Tests using System.Linq; using System.Text; using System.Threading; + using Xunit; - [TestClass] public class PageInfoTests { - [TestMethod] + [Fact] public void BasicUsage() { Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR"); @@ -55,7 +54,7 @@ public void BasicUsage() SrkToolkit.Testing.Assert.Contains("", result); } - [TestMethod] + [Fact] public void OpenGraphTitle() { var title = "super page title"; @@ -64,7 +63,7 @@ public void OpenGraphTitle() SrkToolkit.Testing.Assert.AreEqual("" + title + "", result); } - [TestMethod] + [Fact] public void OpenGraphDescription() { var title = "super page title"; @@ -73,7 +72,7 @@ public void OpenGraphDescription() SrkToolkit.Testing.Assert.AreEqual("", result); } - [TestMethod] + [Fact] public void AlternateLanguage() { var name = "fr-CA"; @@ -83,19 +82,19 @@ public void AlternateLanguage() SrkToolkit.Testing.Assert.AreEqual("", result); } - [TestMethod] + [Fact] public void ContainsNot() { var page = new PageInfo(); - Assert.IsFalse(page.Contains("title")); + Assert.False(page.Contains("title")); } - [TestMethod] + [Fact] public void Contains() { var page = new PageInfo(); page.Set(PageInfo.Title, "hello"); - Assert.IsTrue(page.Contains("title")); + Assert.True(page.Contains("title")); } } } diff --git a/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkHtmlExtensionsTests.cs b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkHtmlExtensionsTests.cs index a6272f9..7714591 100644 --- a/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkHtmlExtensionsTests.cs +++ b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkHtmlExtensionsTests.cs @@ -16,21 +16,24 @@ namespace SrkToolkit.Web.Tests { + using Microsoft.AspNetCore.Mvc; + using Microsoft.AspNetCore.Mvc.Rendering; + using Microsoft.AspNetCore.Mvc.ViewEngines; + using Microsoft.AspNetCore.Mvc.ViewFeatures; + using Microsoft.AspNetCore.Routing; + using Moq; + using SrkToolkit.Web.Fakes; using System; using System.Collections.Generic; + using System.ComponentModel.DataAnnotations; + using System.Diagnostics; + using System.Globalization; + using System.IO; using System.Linq; using System.Text; - using Microsoft.VisualStudio.TestTools.UnitTesting; - using System.Web.Mvc; - using Moq; - using System.Web.Routing; - using System.Web; - using System.IO; - using System.Diagnostics; using System.Threading; - using System.Globalization; - using System.ComponentModel.DataAnnotations; - using SrkToolkit.Web.Fakes; + using System.Web.Mvc; + using Xunit; public class SrkHtmlExtensionsTests { @@ -54,10 +57,9 @@ public static HtmlHelper CreateHtmlHelper(ViewDataDictionary vd) return new HtmlHelper(mockViewContext, mockViewDataContainer.Object); } - [TestClass] public class SetTimezoneMethod { - [TestMethod] + [Fact] public void WorksWithTzObject1() { var data = new ViewDataDictionary(); @@ -65,11 +67,11 @@ public void WorksWithTzObject1() var html = CreateHtmlHelper(data); SrkHtmlExtensions.SetTimezone(html, tz); - Assert.IsNotNull(data["Timezone"]); - Assert.AreEqual(tz, data["Timezone"]); + Assert.NotNull(data["Timezone"]); + Assert.Equal(tz, data["Timezone"]); } - [TestMethod] + [Fact] public void WorksWithTzObject2() { var data = new ViewDataDictionary(); @@ -77,11 +79,11 @@ public void WorksWithTzObject2() var html = CreateHtmlHelper(data); SrkHtmlExtensions.SetTimezone(html, tz); - Assert.IsNotNull(data["Timezone"]); - Assert.AreEqual(tz, data["Timezone"]); + Assert.NotNull(data["Timezone"]); + Assert.Equal(tz, data["Timezone"]); } - [TestMethod] + [Fact] public void WorksWithTzName1() { var data = new ViewDataDictionary(); @@ -90,11 +92,11 @@ public void WorksWithTzName1() var html = CreateHtmlHelper(data); SrkHtmlExtensions.SetTimezone(html, tzName); - Assert.IsNotNull(data["Timezone"]); - Assert.AreEqual(tz, data["Timezone"]); + Assert.NotNull(data["Timezone"]); + Assert.Equal(tz, data["Timezone"]); } - [TestMethod] + [Fact] public void WorksWithTzName2() { var data = new ViewDataDictionary(); @@ -103,11 +105,11 @@ public void WorksWithTzName2() var html = CreateHtmlHelper(data); SrkHtmlExtensions.SetTimezone(html, tzName); - Assert.IsNotNull(data["Timezone"]); - Assert.AreEqual(tz, data["Timezone"]); + Assert.NotNull(data["Timezone"]); + Assert.Equal(tz, data["Timezone"]); } - [TestMethod, ExpectedException(typeof(ArgumentException))] + [Fact, ExpectedException(typeof(ArgumentException))] public void NullTzName() { string tzName = null; @@ -115,7 +117,7 @@ public void NullTzName() SrkHtmlExtensions.SetTimezone(html, tzName); } - [TestMethod, ExpectedException(typeof(ArgumentException))] + [Fact, ExpectedException(typeof(ArgumentException))] public void EmptyTzName() { string tzName = string.Empty; @@ -123,7 +125,7 @@ public void EmptyTzName() SrkHtmlExtensions.SetTimezone(html, tzName); } - [TestMethod, ExpectedException(typeof(TimeZoneNotFoundException))] + [Fact, ExpectedException(typeof(TimeZoneNotFoundException))] public void InvalidTzName() { string tzName = "Lunar Standard Time"; @@ -131,7 +133,7 @@ public void InvalidTzName() SrkHtmlExtensions.SetTimezone(html, tzName); } - [TestMethod] + [Fact] public void GetterWorks1() { var data = new ViewDataDictionary(); @@ -141,11 +143,11 @@ public void GetterWorks1() SrkHtmlExtensions.SetTimezone(html, tzName); var result = SrkHtmlExtensions.GetTimezone(html); - Assert.IsNotNull(result); - Assert.AreEqual(tz, result); + Assert.NotNull(result); + Assert.Equal(tz, result); } - [TestMethod] + [Fact] public void GetterWorks2() { var data = new ViewDataDictionary(); @@ -155,11 +157,11 @@ public void GetterWorks2() SrkHtmlExtensions.SetTimezone(html, tzName); var result = SrkHtmlExtensions.GetTimezone(html); - Assert.IsNotNull(result); - Assert.AreEqual(tz, result); + Assert.NotNull(result); + Assert.Equal(tz, result); } - [TestMethod] + [Fact] public void WorksWhenSetInHttpContext1() { var data = new ViewDataDictionary(); @@ -169,11 +171,11 @@ public void WorksWhenSetInHttpContext1() html.ViewContext.HttpContext.SetTimezone(tz); var result = SrkHtmlExtensions.GetTimezone(html); - Assert.IsNotNull(result); - Assert.AreEqual(tz, result); + Assert.NotNull(result); + Assert.Equal(tz, result); } - [TestMethod] + [Fact] public void WorksWhenSetInHttpContext2() { var data = new ViewDataDictionary(); @@ -183,15 +185,14 @@ public void WorksWhenSetInHttpContext2() html.ViewContext.HttpContext.SetTimezone(tz); var result = SrkHtmlExtensions.GetTimezone(html); - Assert.IsNotNull(result); - Assert.AreEqual(tz, result); + Assert.NotNull(result); + Assert.Equal(tz, result); } } - [TestClass] public class GetUserDateMethod { - [TestMethod] + [Fact] public void UndefinedTzIsUtc_ArgIsUtc_ResultIsUtc() { DateTime source = new DateTime(2013, 1, 29, 13, 28, 21, 1, DateTimeKind.Utc); @@ -202,16 +203,16 @@ public void UndefinedTzIsUtc_ArgIsUtc_ResultIsUtc() DateTime utcResult; var result = SrkHtmlExtensions.GetUserDate(html, source, out utcResult); - Assert.AreEqual(source, result); - Assert.AreEqual(source, utcResult); + Assert.Equal(source, result); + Assert.Equal(source, utcResult); } - [TestMethod] + [Fact] public void UndefinedTzIsUtc_ArgIsLocal_ResultIsUtc() { DateTime orig = new DateTime(2013, 1, 29, 13, 28, 21, 1, DateTimeKind.Utc); DateTime source = orig.ToLocalTime(); - Assert.AreEqual(DateTimeKind.Local, source.Kind); + Assert.Equal(DateTimeKind.Local, source.Kind); TimeZoneInfo tz = null; var html = CreateHtmlHelper(new ViewDataDictionary()); html.SetTimezone(tz); @@ -219,16 +220,16 @@ public void UndefinedTzIsUtc_ArgIsLocal_ResultIsUtc() DateTime utcResult; var result = SrkHtmlExtensions.GetUserDate(html, source, out utcResult); - Assert.AreEqual(orig, result); - Assert.AreEqual(orig, utcResult); + Assert.Equal(orig, result); + Assert.Equal(orig, utcResult); } - [TestMethod] + [Fact] public void UndefinedTzIsUtc_ArgIsUnspecified_ResultIsUtc() { DateTime orig = new DateTime(2013, 1, 29, 13, 28, 21, 1, DateTimeKind.Utc); DateTime source = TimeZoneInfo.Utc.ConvertFromUtc(orig); - Assert.AreEqual(DateTimeKind.Utc, source.Kind); + Assert.Equal(DateTimeKind.Utc, source.Kind); TimeZoneInfo tz = null; var html = CreateHtmlHelper(new ViewDataDictionary()); html.SetTimezone(tz); @@ -236,11 +237,11 @@ public void UndefinedTzIsUtc_ArgIsUnspecified_ResultIsUtc() DateTime utcResult; var result = SrkHtmlExtensions.GetUserDate(html, source, out utcResult); - Assert.AreEqual(orig, result); - Assert.AreEqual(orig, utcResult); + Assert.Equal(orig, result); + Assert.Equal(orig, utcResult); } - [TestMethod] + [Fact] public void RomanceTz_ArgIsUtc_ResultIsRomance() { TimeZoneInfo tz = TimeZoneInfo.FindSystemTimeZoneById("Romance Standard Time"); @@ -252,50 +253,49 @@ public void RomanceTz_ArgIsUtc_ResultIsRomance() DateTime utcResult; var result = SrkHtmlExtensions.GetUserDate(html, source, out utcResult); - Assert.AreEqual(source, result, "wrong user result"); - Assert.AreEqual(orig, utcResult, "wrong UTC result"); + Assert.Equal(source, result, "wrong user result"); + Assert.Equal(orig, utcResult, "wrong UTC result"); } - [TestMethod] + [Fact] public void RomanceTz_ArgIsLocal_ResultIsRomance() { TimeZoneInfo tz = TimeZoneInfo.FindSystemTimeZoneById("Romance Standard Time"); DateTime orig = new DateTime(2013, 1, 29, 13, 28, 21, 1, DateTimeKind.Utc); DateTime source = orig.ToLocalTime(); DateTime expected = tz.ConvertFromUtc(orig); - Assert.AreEqual(DateTimeKind.Local, source.Kind); + Assert.Equal(DateTimeKind.Local, source.Kind); var html = CreateHtmlHelper(new ViewDataDictionary()); html.SetTimezone(tz); DateTime utcResult; var result = SrkHtmlExtensions.GetUserDate(html, source, out utcResult); - Assert.AreEqual(expected, result, "wrong user result"); - Assert.AreEqual(orig, utcResult, "wrong UTC result"); + Assert.Equal(expected, result, "wrong user result"); + Assert.Equal(orig, utcResult, "wrong UTC result"); } - [TestMethod] + [Fact] public void RomanceTz_ArgIsUnspecified_ResultIsUtc() { TimeZoneInfo tz = TimeZoneInfo.FindSystemTimeZoneById("Romance Standard Time"); DateTime orig = new DateTime(2013, 1, 29, 13, 28, 21, 1, DateTimeKind.Utc); DateTime source = tz.ConvertFromUtc(orig); - Assert.AreEqual(DateTimeKind.Unspecified, source.Kind); + Assert.Equal(DateTimeKind.Unspecified, source.Kind); var html = CreateHtmlHelper(new ViewDataDictionary()); html.SetTimezone(tz); DateTime utcResult; var result = SrkHtmlExtensions.GetUserDate(html, source, out utcResult); - Assert.AreEqual(source, result, "wrong user result"); - Assert.AreEqual(orig, utcResult, "wrong UTC result"); + Assert.Equal(source, result, "wrong user result"); + Assert.Equal(orig, utcResult, "wrong UTC result"); } } - [TestClass] public class DisplayDateMethod { - [TestMethod] + [Fact] public void UserIsUtc_ArgIsUtc_ResultIsUtc() { Thread.CurrentThread.CurrentCulture = TestCulture1; @@ -307,10 +307,10 @@ public void UserIsUtc_ArgIsUtc_ResultIsUtc() var result = SrkHtmlExtensions.DisplayDate(html, source); - Assert.AreEqual(expected, result.ToString()); + Assert.Equal(expected, result.ToString()); } - [TestMethod] + [Fact] public void UserIsUtc_ArgIsLocal_ResultIsUtc() { Thread.CurrentThread.CurrentCulture = TestCulture1; @@ -325,10 +325,10 @@ public void UserIsUtc_ArgIsLocal_ResultIsUtc() var result = SrkHtmlExtensions.DisplayDate(html, source); - Assert.AreEqual(expected, result.ToString()); + Assert.Equal(expected, result.ToString()); } - [TestMethod] + [Fact] public void UserIsUtc_ArgIsUser_ResultIsUtc() { Thread.CurrentThread.CurrentCulture = TestCulture1; @@ -341,10 +341,10 @@ public void UserIsUtc_ArgIsUser_ResultIsUtc() var result = SrkHtmlExtensions.DisplayDate(html, source); - Assert.AreEqual(expected, result.ToString()); + Assert.Equal(expected, result.ToString()); } - [TestMethod] + [Fact] public void UserIsRomance_ArgIsUtc_ResultIsRomance() { Thread.CurrentThread.CurrentCulture = TestCulture1; @@ -357,10 +357,10 @@ public void UserIsRomance_ArgIsUtc_ResultIsRomance() var result = SrkHtmlExtensions.DisplayDate(html, source); - Assert.AreEqual(expected, result.ToString()); + Assert.Equal(expected, result.ToString()); } - [TestMethod] + [Fact] public void UserIsRomance_ArgIsLocal_ResultIsRomance() { Thread.CurrentThread.CurrentCulture = TestCulture1; @@ -376,10 +376,10 @@ public void UserIsRomance_ArgIsLocal_ResultIsRomance() var result = SrkHtmlExtensions.DisplayDate(html, source); - Assert.AreEqual(expected, result.ToString()); + Assert.Equal(expected, result.ToString()); } - [TestMethod] + [Fact] public void UserIsRomance_ArgIsUser_ResultIsRomance() { Thread.CurrentThread.CurrentCulture = TestCulture1; @@ -393,14 +393,13 @@ public void UserIsRomance_ArgIsUser_ResultIsRomance() var result = SrkHtmlExtensions.DisplayDate(html, source); - Assert.AreEqual(expected, result.ToString()); + Assert.Equal(expected, result.ToString()); } } - [TestClass] public class DisplayDateTimeMethod { - [TestMethod] + [Fact] public void UserIsUtc_ArgIsUtc_ResultIsUtc() { Thread.CurrentThread.CurrentCulture = TestCulture1; @@ -412,10 +411,10 @@ public void UserIsUtc_ArgIsUtc_ResultIsUtc() var result = SrkHtmlExtensions.DisplayDateTime(html, source); - Assert.AreEqual(expected, result.ToString()); + Assert.Equal(expected, result.ToString()); } - [TestMethod] + [Fact] public void UserIsUtc_ArgIsLocal_ResultIsUtc() { Thread.CurrentThread.CurrentCulture = TestCulture1; @@ -430,10 +429,10 @@ public void UserIsUtc_ArgIsLocal_ResultIsUtc() var result = SrkHtmlExtensions.DisplayDateTime(html, source); - Assert.AreEqual(expected, result.ToString()); + Assert.Equal(expected, result.ToString()); } - [TestMethod] + [Fact] public void UserIsUtc_ArgIsUser_ResultIsUtc() { Thread.CurrentThread.CurrentCulture = TestCulture1; @@ -446,10 +445,10 @@ public void UserIsUtc_ArgIsUser_ResultIsUtc() var result = SrkHtmlExtensions.DisplayDateTime(html, source); - Assert.AreEqual(expected, result.ToString()); + Assert.Equal(expected, result.ToString()); } - [TestMethod] + [Fact] public void UserIsRomance_ArgIsUtc_ResultIsRomance() { Thread.CurrentThread.CurrentCulture = TestCulture1; @@ -462,10 +461,10 @@ public void UserIsRomance_ArgIsUtc_ResultIsRomance() var result = SrkHtmlExtensions.DisplayDateTime(html, source); - Assert.AreEqual(expected, result.ToString()); + Assert.Equal(expected, result.ToString()); } - [TestMethod] + [Fact] public void UserIsRomance_ArgIsLocal_ResultIsRomance() { Thread.CurrentThread.CurrentCulture = TestCulture1; @@ -481,10 +480,10 @@ public void UserIsRomance_ArgIsLocal_ResultIsRomance() var result = SrkHtmlExtensions.DisplayDateTime(html, source); - Assert.AreEqual(expected, result.ToString()); + Assert.Equal(expected, result.ToString()); } - [TestMethod] + [Fact] public void UserIsRomance_ArgIsUser_ResultIsRomance() { Thread.CurrentThread.CurrentCulture = TestCulture1; @@ -498,14 +497,13 @@ public void UserIsRomance_ArgIsUser_ResultIsRomance() var result = SrkHtmlExtensions.DisplayDateTime(html, source); - Assert.AreEqual(expected, result.ToString()); + Assert.Equal(expected, result.ToString()); } } - [TestClass] public class DisplayTimeMethod { - [TestMethod] + [Fact] public void UserIsUtc_ArgIsUtc_ResultIsUtc() { Thread.CurrentThread.CurrentCulture = TestCulture1; @@ -517,10 +515,10 @@ public void UserIsUtc_ArgIsUtc_ResultIsUtc() var result = SrkHtmlExtensions.DisplayTime(html, source); - Assert.AreEqual(expected, result.ToString()); + Assert.Equal(expected, result.ToString()); } - [TestMethod] + [Fact] public void UserIsUtc_ArgIsLocal_ResultIsUtc() { Thread.CurrentThread.CurrentCulture = TestCulture1; @@ -535,10 +533,10 @@ public void UserIsUtc_ArgIsLocal_ResultIsUtc() var result = SrkHtmlExtensions.DisplayTime(html, source); - Assert.AreEqual(expected, result.ToString()); + Assert.Equal(expected, result.ToString()); } - [TestMethod] + [Fact] public void UserIsUtc_ArgIsUser_ResultIsUtc() { Thread.CurrentThread.CurrentCulture = TestCulture1; @@ -551,10 +549,10 @@ public void UserIsUtc_ArgIsUser_ResultIsUtc() var result = SrkHtmlExtensions.DisplayTime(html, source); - Assert.AreEqual(expected, result.ToString()); + Assert.Equal(expected, result.ToString()); } - [TestMethod] + [Fact] public void UserIsRomance_ArgIsUtc_ResultIsRomance() { Thread.CurrentThread.CurrentCulture = TestCulture1; @@ -567,10 +565,10 @@ public void UserIsRomance_ArgIsUtc_ResultIsRomance() var result = SrkHtmlExtensions.DisplayTime(html, source); - Assert.AreEqual(expected, result.ToString()); + Assert.Equal(expected, result.ToString()); } - [TestMethod] + [Fact] public void UserIsRomance_ArgIsLocal_ResultIsRomance() { Thread.CurrentThread.CurrentCulture = TestCulture1; @@ -586,10 +584,10 @@ public void UserIsRomance_ArgIsLocal_ResultIsRomance() var result = SrkHtmlExtensions.DisplayTime(html, source); - Assert.AreEqual(expected, result.ToString()); + Assert.Equal(expected, result.ToString()); } - [TestMethod] + [Fact] public void UserIsRomance_ArgIsUser_ResultIsRomance() { Thread.CurrentThread.CurrentCulture = TestCulture1; @@ -603,26 +601,25 @@ public void UserIsRomance_ArgIsUser_ResultIsRomance() var result = SrkHtmlExtensions.DisplayTime(html, source); - Assert.AreEqual(expected, result.ToString()); + Assert.Equal(expected, result.ToString()); } } - [TestClass] public class JsDateMethod { private static readonly DateTime UnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); - [TestMethod] + [Fact] public void BackAndForth_UtcIn() { long epoch = 13912786171000L; // GMT: Sat, 01 Feb 2014 18:16:57 GMT DateTime utc = UnixEpoch.AddMilliseconds(epoch); var result = SrkHtmlExtensions.JsDate(null, utc); var expected = "new Date(13912786171000)"; - Assert.AreEqual(expected, result.ToString()); + Assert.Equal(expected, result.ToString()); } - [TestMethod] + [Fact] public void BackAndForth_UserTzIn() { long epoch = 13912786171000L; // GMT: Sat, 01 Feb 2014 18:16:57 GMT @@ -633,10 +630,10 @@ public void BackAndForth_UserTzIn() html.SetTimezone(tz); var result = SrkHtmlExtensions.JsDate(html, user); var expected = "new Date(13912786171000)"; - Assert.AreEqual(expected, result.ToString()); + Assert.Equal(expected, result.ToString()); } - [TestMethod] + [Fact] public void BackAndForth_LocalTzIn() { long epoch = 13912786171000L; // GMT: Sat, 01 Feb 2014 18:16:57 GMT @@ -645,33 +642,31 @@ public void BackAndForth_LocalTzIn() var html = CreateHtmlHelper(new ViewDataDictionary()); var result = SrkHtmlExtensions.JsDate(html, local); var expected = "new Date(13912786171000)"; - Assert.AreEqual(expected, result.ToString()); + Assert.Equal(expected, result.ToString()); } } - [TestClass] public class DisplayTextMethod { - [TestMethod] + [Fact] public void BugWithSingleQuoteAndTwotter() { var input = "J'ai ajouté une"; var expected = "J'ai ajouté une"; var result = SrkHtmlExtensions.DisplayText(null, input, twitterLinks: true, makeParagraphs: false); - SrkToolkit.Testing.Assert.AreEqual(expected, result.ToString()); + SrkToolkit.Testing.Assert.Equal(expected, result.ToString()); } } - [TestClass] public class HasOtherValidationErrorsMethod { - [TestMethod, ExpectedException(typeof(ArgumentNullException))] + [Fact, ExpectedException(typeof(ArgumentNullException))] public void ThrowsWhenArg0IsNull() { SrkHtmlExtensions.HasOtherValidationErrors(null); } - [TestMethod] + [Fact] public void ModelIsValid_ReturnsFalse() { var model = new TestModel { Name = "hello", }; @@ -679,10 +674,10 @@ public void ModelIsValid_ReturnsFalse() var result = SrkHtmlExtensions.HasOtherValidationErrors(html); - Assert.IsFalse(result); + Assert.False(result); } - [TestMethod] + [Fact] public void ModelIsPropertyInvalid_ReturnsFalse() { var model = new TestModel { Name = null, }; @@ -690,10 +685,10 @@ public void ModelIsPropertyInvalid_ReturnsFalse() var result = SrkHtmlExtensions.HasOtherValidationErrors(html); - Assert.IsFalse(result); + Assert.False(result); } - [TestMethod] + [Fact] public void ModelIsOtherInvalid_ReturnsFalse() { var model = new TestModel { Name = "hello", }; @@ -702,14 +697,13 @@ public void ModelIsOtherInvalid_ReturnsFalse() var result = SrkHtmlExtensions.HasOtherValidationErrors(html); - Assert.IsTrue(result); + Assert.True(result); } } - [TestClass] public class ValidationSummaryExMethod { - [TestMethod] + [Fact] public void ModelIsOtherInvalid_Shows() { var model = new TestModel { Name = "hello", }; @@ -717,70 +711,69 @@ public void ModelIsOtherInvalid_Shows() html.ViewData.ModelState.AddModelError(string.Empty, "Other error"); var response = SrkHtmlExtensions.ValidationSummaryEx(html); var isDisplayed = response != null && response.ToString().Length > 0; - Assert.IsTrue(isDisplayed); + Assert.True(isDisplayed); } - [TestMethod] + [Fact] public void ModelIsPropertyInvalid_Hides() { var model = new TestModel { Name = "hello", }; var html = GetHtmlHelper(model); var response = SrkHtmlExtensions.ValidationSummaryEx(html); var isDisplayed = response != null && response.ToString().Length > 0; - Assert.IsFalse(isDisplayed); + Assert.False(isDisplayed); } - [TestMethod] + [Fact] public void ModelIsValid_Hides() { var model = new TestModel { Name = "hello", }; var html = GetHtmlHelper(model); var response = SrkHtmlExtensions.ValidationSummaryEx(html); var isDisplayed = response != null && response.ToString().Length > 0; - Assert.IsFalse(isDisplayed); + Assert.False(isDisplayed); } } - [TestClass] public class DescriptionForMethod { - [TestMethod] + [Fact] public void NoDescriptionReturnsEmptyString() { var model = new TestModel(); var html = this.GetHtmlHeper(model); var result = SrkHtmlExtensions.DescriptionFor(html, m => m.Name); - Assert.IsNull(result.ToString().NullIfEmpty()); + Assert.Null(result.ToString().NullIfEmpty()); } - [TestMethod] + [Fact] public void EmptyDescriptionReturnsEmptyString() { var model = new TestModel(); var html = this.GetHtmlHeper(model); var result = SrkHtmlExtensions.DescriptionFor(html, m => m.Description); - Assert.IsNull(result.ToString().NullIfEmpty()); + Assert.Null(result.ToString().NullIfEmpty()); } - [TestMethod] + [Fact] public void ValidDescriptionReturnsHtmlAndValue() { var model = new TestModel(); var html = this.GetHtmlHeper(model); var result = SrkHtmlExtensions.DescriptionFor(html, m => m.Description2); - Assert.AreEqual("Desc a2a", result.ToString().NullIfEmpty()); + Assert.Equal("Desc a2a", result.ToString().NullIfEmpty()); } - [TestMethod] + [Fact] public void ForIsValidAtLevel1() { var model = new TestModel(); var html = this.GetHtmlHeper(model); var result = SrkHtmlExtensions.DescriptionFor(html, m => m.Description2); - Assert.AreEqual("Desc a2a", result.ToString().NullIfEmpty()); + Assert.Equal("Desc a2a", result.ToString().NullIfEmpty()); } - [TestMethod] + [Fact] public void ForIsValidAtLevel2() { var model = new TestModel @@ -789,16 +782,16 @@ public void ForIsValidAtLevel2() }; var html = this.GetHtmlHeper(model); var result = SrkHtmlExtensions.DescriptionFor(html, m => m.SubModel.Description2); - Assert.AreEqual("Desc a2a", result.ToString().NullIfEmpty()); + Assert.Equal("Desc a2a", result.ToString().NullIfEmpty()); } - [TestMethod] + [Fact] public void AcceptsHtmlAttributes() { var model = new TestModel(); var html = this.GetHtmlHeper(model); var result = SrkHtmlExtensions.DescriptionFor(html, m => m.Description2, new { attr1 = "value", }); - Assert.AreEqual("Desc a2a", result.ToString().NullIfEmpty()); + Assert.Equal("Desc a2a", result.ToString().NullIfEmpty()); } private HtmlHelper GetHtmlHeper(TModel model) @@ -816,34 +809,33 @@ private HtmlHelper GetHtmlHeper(TModel model) } } - [TestClass] public class CallLinkMethod { - [TestMethod] + [Fact] public void InternationalFrenchStandardFormat() { string phone = "+33 123456789"; string expected = @"" + phone + ""; var result = SrkHtmlExtensions.CallLink(null, phone); - Assert.AreEqual(expected, result.ToString()); + Assert.Equal(expected, result.ToString()); } - [TestMethod] + [Fact] public void NationalFrenchStandardFormat() { string phone = "0123456789"; string expected = @"" + phone + ""; var result = SrkHtmlExtensions.CallLink(null, phone); - Assert.AreEqual(expected, result.ToString()); + Assert.Equal(expected, result.ToString()); } - [TestMethod] + [Fact] public void NationalUsaStandardFormat() { string phone = "123-456-7890"; string expected = @"" + phone + ""; var result = SrkHtmlExtensions.CallLink(null, phone); - Assert.AreEqual(expected, result.ToString()); + Assert.Equal(expected, result.ToString()); } } diff --git a/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkHttpContextExtensionsTests.cs b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkHttpContextExtensionsTests.cs index a323d78..2d35709 100644 --- a/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkHttpContextExtensionsTests.cs +++ b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkHttpContextExtensionsTests.cs @@ -16,30 +16,28 @@ namespace SrkToolkit.Web.Tests { - using Microsoft.VisualStudio.TestTools.UnitTesting; using SrkToolkit.Web.Fakes; using System; using System.Collections.Generic; using System.Linq; + using Xunit; - [TestClass] public class SrkHttpContextExtensionsTests { - [TestClass] public class SetTimezoneMethod { - [TestMethod] + [Fact] public void WorksWithTzObject() { var tz = TimeZoneInfo.FindSystemTimeZoneById("Romance Standard Time"); var http = new BasicHttpContext(); SrkHttpContextExtensions.SetTimezone(http, tz); - Assert.IsNotNull(http.Items["Timezone"]); - Assert.AreEqual(tz, http.Items["Timezone"]); + Assert.NotNull(http.Items["Timezone"]); + Assert.Equal(tz, http.Items["Timezone"]); } - [TestMethod] + [Fact] public void WorksWithTzName() { var tzName = "Romance Standard Time"; @@ -47,11 +45,11 @@ public void WorksWithTzName() var http = new BasicHttpContext(); SrkHttpContextExtensions.SetTimezone(http, tzName); - Assert.IsNotNull(http.Items["Timezone"]); - Assert.AreEqual(tz, http.Items["Timezone"]); + Assert.NotNull(http.Items["Timezone"]); + Assert.Equal(tz, http.Items["Timezone"]); } - [TestMethod, ExpectedException(typeof(ArgumentException))] + [Fact, ExpectedException(typeof(ArgumentException))] public void NullTzName() { string tzName = null; @@ -59,7 +57,7 @@ public void NullTzName() SrkHttpContextExtensions.SetTimezone(http, tzName); } - [TestMethod, ExpectedException(typeof(ArgumentException))] + [Fact, ExpectedException(typeof(ArgumentException))] public void EmptyTzName() { string tzName = string.Empty; @@ -67,7 +65,7 @@ public void EmptyTzName() SrkHttpContextExtensions.SetTimezone(http, tzName); } - [TestMethod, ExpectedException(typeof(TimeZoneNotFoundException))] + [Fact, ExpectedException(typeof(TimeZoneNotFoundException))] public void InvalidTzName() { string tzName = "Lunar Standard Time"; @@ -75,7 +73,7 @@ public void InvalidTzName() SrkHttpContextExtensions.SetTimezone(http, tzName); } - [TestMethod] + [Fact] public void GetterWorks() { var tzName = "Romance Standard Time"; @@ -84,8 +82,8 @@ public void GetterWorks() SrkHttpContextExtensions.SetTimezone(http, tzName); var result = SrkHttpContextExtensions.GetTimezone(http); - Assert.IsNotNull(result); - Assert.AreEqual(tz, result); + Assert.NotNull(result); + Assert.Equal(tz, result); } } } diff --git a/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkMvcCollectionExtensionsTests.cs b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkMvcCollectionExtensionsTests.cs index 43a8d9d..ab37473 100644 --- a/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkMvcCollectionExtensionsTests.cs +++ b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkMvcCollectionExtensionsTests.cs @@ -16,47 +16,57 @@ namespace SrkToolkit.Web.Tests { + using Microsoft.AspNetCore.Mvc.Rendering; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Web.Mvc; - using Microsoft.VisualStudio.TestTools.UnitTesting; + using Xunit; public class SrkMvcCollectionExtensionsTests { - [TestClass] public class ToSelectListMethod { - [TestMethod, ExpectedException(typeof(ArgumentNullException))] + [Fact] public void NullCollectionThrows() { List collection = null; - var result = SrkMvcCollectionExtensions.ToSelectList(collection, o => o.ToString(), o => o.ToString(), o => false); + + Assert.Throws(() => + { + var result = SrkMvcCollectionExtensions.ToSelectList(collection, o => o.ToString(), o => o.ToString(), o => false); + }); } - [TestMethod, ExpectedException(typeof(ArgumentNullException))] + [Fact] public void NullValueSelectorThrows() { List collection = null; - var result = SrkMvcCollectionExtensions.ToSelectList(collection, null, o => o.ToString(), o => false); + Assert.Throws(() => + { + var result = SrkMvcCollectionExtensions.ToSelectList(collection, null, o => o.ToString(), o => false); + }); } - [TestMethod, ExpectedException(typeof(ArgumentNullException))] + [Fact] public void NullDisplaySelectorThrows() { List collection = null; - var result = SrkMvcCollectionExtensions.ToSelectList(collection, o => o.ToString(), null, o => false); + Assert.Throws(() => + { + var result = SrkMvcCollectionExtensions.ToSelectList(collection, o => o.ToString(), null, o => false); + }); } - [TestMethod] + [Fact] public void NullSelectedSelectorDoesNotThrow() { List collection = new List(); var result = SrkMvcCollectionExtensions.ToSelectList(collection, o => o.ToString(), o => o.ToString(), null); } - [TestMethod] + [Fact] public void SimpleListAndNullSelectedSelector() { List> collection = GetSimpleList(); @@ -64,7 +74,7 @@ public void SimpleListAndNullSelectedSelector() Verify(collection, result, null); } - [TestMethod] + [Fact] public void SimpleListWithSelectedSelector() { List> collection = GetSimpleList(); @@ -87,17 +97,17 @@ private static List> GetSimpleList() private static void Verify(List> collection, IList result, int? selected) { - Assert.AreEqual(collection.Count, result.Count()); + Assert.Equal(collection.Count, result.Count()); for (int i = 0; i < collection.Count; i++) { var item = result.Skip(i).First(); - Assert.AreEqual(collection[i].Item1.ToString(), item.Value); - Assert.AreEqual(collection[i].Item2.ToString(), item.Text); + Assert.Equal(collection[i].Item1.ToString(), item.Value); + Assert.Equal(collection[i].Item2.ToString(), item.Text); if (selected != null && selected.Value == collection[i].Item1) - Assert.IsTrue(item.Selected); + Assert.True(item.Selected); else - Assert.IsFalse(item.Selected); + Assert.False(item.Selected); } } } diff --git a/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkRequestExtensionsTests.cs b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkRequestExtensionsTests.cs index 6b352bd..4f08107 100644 --- a/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkRequestExtensionsTests.cs +++ b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkRequestExtensionsTests.cs @@ -16,106 +16,103 @@ namespace SrkToolkit.Web.Tests { + using SrkToolkit.Web.Fakes; using System; using System.Collections.Generic; using System.Linq; using System.Text; - using Microsoft.VisualStudio.TestTools.UnitTesting; - using System.Web; - using SrkToolkit.Web.Fakes; + using Xunit; public class SrkRequestExtensionsTests { - [TestClass] public class IsUrlLocalToHostMethod { - [TestMethod] + [Fact] public void LocalNoSlash_IsNotLocal() { HttpRequestBase request = null; string url = "controller/action/id"; - Assert.IsFalse(SrkRequestExtensions.IsUrlLocalToHost(request, url)); + Assert.False(SrkRequestExtensions.IsUrlLocalToHost(request, url)); } - [TestMethod] + [Fact] public void LocalSlash_IsLocal() { HttpRequestBase request = null; string url = "/controller/action/id"; - Assert.IsTrue(SrkRequestExtensions.IsUrlLocalToHost(request, url)); + Assert.True(SrkRequestExtensions.IsUrlLocalToHost(request, url)); } - [TestMethod] + [Fact] public void WithProtocal_IsNotLocal() { HttpRequestBase request = null; string url = "http://test.com/controller/action/id"; - Assert.IsFalse(SrkRequestExtensions.IsUrlLocalToHost(request, url)); + Assert.False(SrkRequestExtensions.IsUrlLocalToHost(request, url)); } } - [TestClass] public class PrefersJsonMethod { - [TestMethod, ExpectedException(typeof(ArgumentNullException))] + [Fact, ExpectedException(typeof(ArgumentNullException))] public void ArgNullThrows() { BasicHttpRequest request = null; SrkRequestExtensions.PrefersJson(request); } - [TestMethod] + [Fact] public void NullAcceptTypesReturnsFalse() { string[] acceptTypes = null; var request = new BasicHttpRequest(); request.AcceptTypesCollection = acceptTypes; - Assert.IsFalse(SrkRequestExtensions.PrefersJson(request)); + Assert.False(SrkRequestExtensions.PrefersJson(request)); } - [TestMethod] + [Fact] public void EmptyAcceptTypesReturnsFalse() { string[] acceptTypes = new string[0]; var request = new BasicHttpRequest(); request.AcceptTypesCollection = acceptTypes; - Assert.IsFalse(SrkRequestExtensions.PrefersJson(request)); + Assert.False(SrkRequestExtensions.PrefersJson(request)); } - [TestMethod] + [Fact] public void HtmlAcceptTypesReturnsFalse() { string[] acceptTypes = new string[] { "text/html", "application/xhtml+xml", "application/xml", "*/*", }; var request = new BasicHttpRequest(); request.AcceptTypesCollection = acceptTypes; - Assert.IsFalse(SrkRequestExtensions.PrefersJson(request)); + Assert.False(SrkRequestExtensions.PrefersJson(request)); } - [TestMethod] + [Fact] public void JsonXmlAcceptTypesReturnsFalse() { string[] acceptTypes = new string[] { "application/json", "application/xml", }; var request = new BasicHttpRequest(); request.AcceptTypesCollection = acceptTypes; - Assert.IsTrue(SrkRequestExtensions.PrefersJson(request)); + Assert.True(SrkRequestExtensions.PrefersJson(request)); } - [TestMethod] + [Fact] public void XmlJsonAcceptTypesReturnsFalse() { string[] acceptTypes = new string[] { "application/xml", "application/json", }; var request = new BasicHttpRequest(); request.AcceptTypesCollection = acceptTypes; - Assert.IsFalse(SrkRequestExtensions.PrefersJson(request)); + Assert.False(SrkRequestExtensions.PrefersJson(request)); } - [TestMethod] + [Fact] public void TextJsonAcceptTypesReturnsFalse() { string[] acceptTypes = new string[] { "text/json", "application/xml", }; var request = new BasicHttpRequest(); request.AcceptTypesCollection = acceptTypes; - Assert.IsTrue(SrkRequestExtensions.PrefersJson(request)); + Assert.True(SrkRequestExtensions.PrefersJson(request)); } } } diff --git a/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkToolkit.AspNetCore2.UnitTests.csproj b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkToolkit.AspNetCore2.UnitTests.csproj index 9ed2389..4241efe 100644 --- a/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkToolkit.AspNetCore2.UnitTests.csproj +++ b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkToolkit.AspNetCore2.UnitTests.csproj @@ -21,6 +21,7 @@ + runtime; build; native; contentfiles; analyzers; buildtransitive @@ -36,4 +37,21 @@ + + + + + + + + + + + + + + + + + diff --git a/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkUrlHelperExtensionsTests.cs b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkUrlHelperExtensionsTests.cs index d8d76e3..47468b4 100644 --- a/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkUrlHelperExtensionsTests.cs +++ b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkUrlHelperExtensionsTests.cs @@ -16,22 +16,22 @@ namespace SrkToolkit.Web.Tests { + using Microsoft.AspNetCore.Http; + using Microsoft.AspNetCore.Mvc.Routing; + using Microsoft.AspNetCore.Routing; using System; using System.Collections.Generic; + using System.IO; using System.Linq; using System.Text; - using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Web.Mvc; - using System.Web.Routing; - using System.Web; - using System.IO; + using Xunit; public class SrkUrlHelperExtensionsTests { - [TestClass] public class SetQueryStringMethod { - [TestMethod] + [Fact] public void WithNoQuery() { // prepare @@ -44,10 +44,10 @@ public void WithNoQuery() string actual = helper.SetQueryString(input, "k1", "v1"); // verify - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } - [TestMethod] + [Fact] public void WithNoPath() { // prepare @@ -60,10 +60,10 @@ public void WithNoPath() string actual = helper.SetQueryString(input, "k1", "v1"); // verify - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } - [TestMethod] + [Fact] public void WithQueryDelimiter() { // prepare @@ -77,10 +77,10 @@ public void WithQueryDelimiter() string actual = helper.SetQueryString(input, "k1", "v1"); // verify - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } - [TestMethod] + [Fact] public void WithOtherQueryKey() { // prepare @@ -94,7 +94,7 @@ public void WithOtherQueryKey() string actual = helper.SetQueryString(input, "k1", "v1"); // verify - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } private static UrlHelper GetHelper(string path, string query) @@ -108,7 +108,7 @@ private static UrlHelper GetHelper(string path, string query) return helper; } - [TestMethod] + [Fact] public void WithSameQueryKey() { // prepare @@ -122,10 +122,10 @@ public void WithSameQueryKey() string actual = helper.SetQueryString(input, "k1", "v1"); // verify - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } - [TestMethod] + [Fact] public void MultipleValues() { // prepare @@ -138,10 +138,10 @@ public void MultipleValues() string actual = helper.SetQueryString(input, "k1", "v111", "k2", "v2"); // verify - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } - [TestMethod] + [Fact] public void MultipleValuesOneSet() { // prepare @@ -154,10 +154,10 @@ public void MultipleValuesOneSet() string actual = helper.SetQueryString(input, "k1", "v111", "k2", "v2"); // verify - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } - [TestMethod] + [Fact] public void SpecialCharInOriginalQuery() { string path = @"/Area/Ctrl/Action"; @@ -168,10 +168,10 @@ public void SpecialCharInOriginalQuery() string actual = helper.SetQueryString(url, "page", "2"); - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } - [TestMethod] + [Fact] public void SpecialCharInNewQueryValue() { string path = @"/Area/Ctrl/Action"; @@ -182,10 +182,10 @@ public void SpecialCharInNewQueryValue() string actual = helper.SetQueryString(url, "search", "hello world"); - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } - [TestMethod] + [Fact] public void NullValueProducesNoKVP() { string path = @"/Area/Ctrl/Action"; @@ -196,10 +196,10 @@ public void NullValueProducesNoKVP() string actual = helper.SetQueryString(url, "nullstuff", null); - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } - [TestMethod] + [Fact] public void NullValueRemovesExistingValue() { string path = @"/Area/Ctrl/Action"; @@ -210,10 +210,10 @@ public void NullValueRemovesExistingValue() string actual = helper.SetQueryString(url, "nullstuff", null); - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } - [TestMethod] + [Fact] public void BaseMultipleValues_SetMultipleValues() { // prepare @@ -226,10 +226,10 @@ public void BaseMultipleValues_SetMultipleValues() string actual = helper.SetQueryString(input, "k1", "v1", "k1", "v3"); // key has 2 values // verify - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } - [TestMethod] + [Fact] public void BaseMultipleValues_ResetAndSetMultipleValues() { // prepare @@ -242,14 +242,13 @@ public void BaseMultipleValues_ResetAndSetMultipleValues() string actual = helper.SetQueryString(input, "k1", null, "k1", "v1", "k1", "v3"); // key has 2 values // verify - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } } - [TestClass] public class ResetQueryStringMethod { - [TestMethod] + [Fact] public void WithNoQuery() { // prepare @@ -262,10 +261,10 @@ public void WithNoQuery() string actual = helper.ResetQueryString(input, "k1", "v1"); // verify - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } - [TestMethod] + [Fact] public void WithNoPath() { // prepare @@ -278,10 +277,10 @@ public void WithNoPath() string actual = helper.ResetQueryString(input, "k1", "v1"); // verify - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } - [TestMethod] + [Fact] public void WithQueryDelimiter() { // prepare @@ -295,10 +294,10 @@ public void WithQueryDelimiter() string actual = helper.ResetQueryString(input, "k1", "v1"); // verify - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } - [TestMethod] + [Fact] public void WithOtherQueryKey() { // prepare @@ -312,7 +311,7 @@ public void WithOtherQueryKey() string actual = helper.ResetQueryString(input, "k1", "v1"); // verify - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } private static UrlHelper GetHelper(string path, string query) @@ -326,7 +325,7 @@ private static UrlHelper GetHelper(string path, string query) return helper; } - [TestMethod] + [Fact] public void WithSameQueryKey() { // prepare @@ -340,10 +339,10 @@ public void WithSameQueryKey() string actual = helper.ResetQueryString(input, "k1", "v1"); // verify - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } - [TestMethod] + [Fact] public void MultipleValues() { // prepare @@ -356,10 +355,10 @@ public void MultipleValues() string actual = helper.ResetQueryString(input, "k1", "v111", "k2", "v2"); // verify - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } - [TestMethod] + [Fact] public void MultipleValuesOneSet() { // prepare @@ -372,10 +371,10 @@ public void MultipleValuesOneSet() string actual = helper.ResetQueryString(input, "k1", "v111", "k2", "v2"); // verify - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } - [TestMethod] + [Fact] public void SpecialCharInOriginalQuery() { string path = @"/Area/Ctrl/Action"; @@ -386,10 +385,10 @@ public void SpecialCharInOriginalQuery() string actual = helper.ResetQueryString(url, "page", "2"); - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } - [TestMethod] + [Fact] public void SpecialCharInNewQueryValue() { string path = @"/Area/Ctrl/Action"; @@ -400,10 +399,10 @@ public void SpecialCharInNewQueryValue() string actual = helper.ResetQueryString(url, "search", "hello world"); - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } - [TestMethod] + [Fact] public void NullValueProducesNoKVP() { string path = @"/Area/Ctrl/Action"; @@ -414,10 +413,10 @@ public void NullValueProducesNoKVP() string actual = helper.ResetQueryString(url, "nullstuff", null); - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } - [TestMethod] + [Fact] public void NullValueRemovesExistingValue() { string path = @"/Area/Ctrl/Action"; @@ -428,10 +427,10 @@ public void NullValueRemovesExistingValue() string actual = helper.ResetQueryString(url, "nullstuff", null); - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } - [TestMethod] + [Fact] public void BaseMultipleValues_SetMultipleValues() { // prepare @@ -444,10 +443,10 @@ public void BaseMultipleValues_SetMultipleValues() string actual = helper.ResetQueryString(input, "k1", "v1", "k1", "v3"); // key has 2 values // verify - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } - [TestMethod] + [Fact] public void BaseMultipleValues_ResetAndSetMultipleValues() { // prepare @@ -460,7 +459,7 @@ public void BaseMultipleValues_ResetAndSetMultipleValues() string actual = helper.ResetQueryString(input, "k1", null, "k1", "v1", "k1", "v3"); // key has 2 values // verify - Assert.AreEqual(expected, actual); + Assert.Equal(expected, actual); } } } diff --git a/Sources/SrkToolkit.AspNetCore2.UnitTests/WebDependenciesTests.cs b/Sources/SrkToolkit.AspNetCore2.UnitTests/WebDependenciesTests.cs index 806c697..26b5178 100644 --- a/Sources/SrkToolkit.AspNetCore2.UnitTests/WebDependenciesTests.cs +++ b/Sources/SrkToolkit.AspNetCore2.UnitTests/WebDependenciesTests.cs @@ -20,21 +20,19 @@ namespace SrkToolkit.Web.Tests using System.Collections.Generic; using System.Linq; using System.Text; - using Microsoft.VisualStudio.TestTools.UnitTesting; + using Xunit; - [TestClass] public class WebDependenciesTests { - [TestClass] public class RenderMethod { - [TestMethod, ExpectedException(typeof(ArgumentNullException))] + [Fact, ExpectedException(typeof(ArgumentNullException))] public void ArgNull() { new WebDependencies().Render(null); } - [TestMethod] + [Fact] public void JsWorks() { string expected = "\r\n"; @@ -44,7 +42,7 @@ public void JsWorks() SrkToolkit.Testing.Assert.AreEqual(expected, result.ToString()); } - [TestMethod] + [Fact] public void CssWorks() { string expected = "\r\n"; @@ -54,7 +52,7 @@ public void CssWorks() SrkToolkit.Testing.Assert.AreEqual(expected, result.ToString()); } - [TestMethod] + [Fact] public void CssWithMediaWorks() { string expected = "\r\n"; @@ -67,7 +65,7 @@ public void CssWithMediaWorks() SrkToolkit.Testing.Assert.AreEqual(expected, result.ToString()); } - [TestMethod] + [Fact] public void CssWithMediasWorks() { string expected = "\r\n"; @@ -80,7 +78,7 @@ public void CssWithMediasWorks() SrkToolkit.Testing.Assert.AreEqual(expected, result.ToString()); } - [TestMethod] + [Fact] public void JsWithAttributesWorks() { string expected = "\r\n"; @@ -94,7 +92,7 @@ public void JsWithAttributesWorks() SrkToolkit.Testing.Assert.AreEqual(expected, result.ToString()); } - [TestMethod] + [Fact] public void JsWith1AttributeAsStringParamsWorks() { string expected = "\r\n"; @@ -109,7 +107,7 @@ public void JsWith1AttributeAsStringParamsWorks() SrkToolkit.Testing.Assert.AreEqual(expected, result.ToString()); } - [TestMethod] + [Fact] public void JsWith2AttributeAsStringParamsWorks() { string expected = "\r\n"; @@ -124,7 +122,7 @@ public void JsWith2AttributeAsStringParamsWorks() SrkToolkit.Testing.Assert.AreEqual(expected, result.ToString()); } - [TestMethod] + [Fact] public void AppliesOrder_AllZero_Order1() { string expected = "\r\n" @@ -146,7 +144,7 @@ public void AppliesOrder_AllZero_Order1() SrkToolkit.Testing.Assert.AreEqual(expected, result.ToString()); } - [TestMethod] + [Fact] public void AppliesOrder_AllZero_Order2() { string expected = "\r\n" @@ -168,7 +166,7 @@ public void AppliesOrder_AllZero_Order2() SrkToolkit.Testing.Assert.AreEqual(expected, result.ToString()); } - [TestMethod] + [Fact] public void AppliesOrder_Ordered_Order1() { string expected = "\r\n" @@ -190,7 +188,7 @@ public void AppliesOrder_Ordered_Order1() SrkToolkit.Testing.Assert.AreEqual(expected, result.ToString()); } - [TestMethod] + [Fact] public void AppliesOrder_Ordered_Order2() { string expected = "\r\n" @@ -212,7 +210,7 @@ public void AppliesOrder_Ordered_Order2() SrkToolkit.Testing.Assert.AreEqual(expected, result.ToString()); } - [TestMethod] + [Fact] public void MultipleInclude_shouldChooseTheHighestPosition_WithDefaultFirst() { string expectedEndOfPage = "\r\n" @@ -237,7 +235,7 @@ public void MultipleInclude_shouldChooseTheHighestPosition_WithDefaultFirst() SrkToolkit.Testing.Assert.AreEqual(expectedEndOfPage, result.ToString()); } - [TestMethod] + [Fact] public void MultipleInclude_shouldChooseTheHighestPosition_WithDefaultSecond() { string expectedEndOfPage = "\r\n" @@ -262,7 +260,7 @@ public void MultipleInclude_shouldChooseTheHighestPosition_WithDefaultSecond() SrkToolkit.Testing.Assert.AreEqual(expectedEndOfPage, result.ToString()); } - [TestMethod] + [Fact] public void MultipleInclude_shouldChooseTheHighestPosition_WithoutDefault() { string expectedHead = "\r\n" diff --git a/Sources/SrkToolkit.Web.AspNetCore2/System.Web.Mvc/SrkUrlHelperExtensions.cs b/Sources/SrkToolkit.Web.AspNetCore2/System.Web.Mvc/SrkUrlHelperExtensions.cs index 91b49f2..b8d9cbf 100644 --- a/Sources/SrkToolkit.Web.AspNetCore2/System.Web.Mvc/SrkUrlHelperExtensions.cs +++ b/Sources/SrkToolkit.Web.AspNetCore2/System.Web.Mvc/SrkUrlHelperExtensions.cs @@ -282,7 +282,5 @@ private static string SetQueryString(string pathAndQuery, bool resetCurrentKey, return builder.ToString(); } - - } } From 0924f6080fd4df24c562390a0e8ea6b1071e6e66 Mon Sep 17 00:00:00 2001 From: SandRock Date: Fri, 10 Mar 2023 14:57:39 +0100 Subject: [PATCH 05/34] publish 2.0.144 --- Package/version.txt | 2 +- Sources/SrkToolkit.Common/SrkToolkit.Common.csproj | 5 +++-- .../SrkToolkit.Domain.AspNetCore2.csproj | 5 +++-- Sources/SrkToolkit.Domain/SrkToolkit.Domain.csproj | 5 +++-- .../SrkToolkit.Web.AspNetCore2.csproj | 7 ++++--- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Package/version.txt b/Package/version.txt index 190a292..3ae35be 100644 --- a/Package/version.txt +++ b/Package/version.txt @@ -1 +1 @@ -1.2.142 \ No newline at end of file +2.0.144 \ No newline at end of file diff --git a/Sources/SrkToolkit.Common/SrkToolkit.Common.csproj b/Sources/SrkToolkit.Common/SrkToolkit.Common.csproj index 580d88e..e72646a 100644 --- a/Sources/SrkToolkit.Common/SrkToolkit.Common.csproj +++ b/Sources/SrkToolkit.Common/SrkToolkit.Common.csproj @@ -6,12 +6,13 @@ net40;net7.0;netstandard2.0 9 true - 2.0.0-preview + 2.0.144-preview1 SandRock, pyDez + Apache-2.0 SrkToolkit.Common contains various extension methods, validators and utility classes. https://github.com/sandrock/SrkToolkit/ - https://github.com/sandrock/SrkToolkit/blob/master/LICENSE SrkToolkit extension method extensions methods dataannotations validation + Preview 1 of SrkToolkit v2. Not ready for production; use at your own risk. 2.0.0.0 2.0.0.0 true diff --git a/Sources/SrkToolkit.Domain.AspNetCore2/SrkToolkit.Domain.AspNetCore2.csproj b/Sources/SrkToolkit.Domain.AspNetCore2/SrkToolkit.Domain.AspNetCore2.csproj index c0f6569..83a9e92 100644 --- a/Sources/SrkToolkit.Domain.AspNetCore2/SrkToolkit.Domain.AspNetCore2.csproj +++ b/Sources/SrkToolkit.Domain.AspNetCore2/SrkToolkit.Domain.AspNetCore2.csproj @@ -6,11 +6,12 @@ enable SrkToolkit.Domain.AspNetCore2 true - 2.0.0-preview1 + 2.0.144-preview1 SandRock + Apache-2.0 SrkToolkit.Domain.AspNetCore2 contains extension methods for SrkToolkit.Domain in the context of a ASP MVC Core application. https://github.com/sandrock/SrkToolkit/ - https://github.com/sandrock/SrkToolkit/blob/master/LICENSE + Preview 1 of SrkToolkit v2. Not ready for production; use at your own risk. SrkToolkit domain AspMvcCore 2.0.0.0 2.0.0.0 diff --git a/Sources/SrkToolkit.Domain/SrkToolkit.Domain.csproj b/Sources/SrkToolkit.Domain/SrkToolkit.Domain.csproj index 0629771..c2e794a 100644 --- a/Sources/SrkToolkit.Domain/SrkToolkit.Domain.csproj +++ b/Sources/SrkToolkit.Domain/SrkToolkit.Domain.csproj @@ -6,11 +6,12 @@ net46;net7.0;netstandard2.0 9 true - 2.0.0-preview1 + 2.0.144-preview1 SandRock + Apache-2.0 SrkToolkit.Domain is used in your domain layer to provider RPC-style request and result classes. https://github.com/sandrock/SrkToolkit/ - https://github.com/sandrock/SrkToolkit/blob/master/LICENSE + Preview 1 of SrkToolkit v2. Not ready for production; use at your own risk. SrkToolkit domain 2.0.0.0 2.0.0.0 diff --git a/Sources/SrkToolkit.Web.AspNetCore2/SrkToolkit.Web.AspNetCore2.csproj b/Sources/SrkToolkit.Web.AspNetCore2/SrkToolkit.Web.AspNetCore2.csproj index f4d3d31..63d65fc 100644 --- a/Sources/SrkToolkit.Web.AspNetCore2/SrkToolkit.Web.AspNetCore2.csproj +++ b/Sources/SrkToolkit.Web.AspNetCore2/SrkToolkit.Web.AspNetCore2.csproj @@ -6,11 +6,12 @@ default SrkToolkit.Web.AspNetCore2 true - 2.0.0-preview1 + 2.0.144-preview1 SandRock - SrkToolkit.Web.AspNetCore2 is a bunch of extensions and tools to use with your ASP MVC Core project. + Apache-2.0 + SrkToolkit.Web.AspNetCore2 is a bunch of extensions and components to use with your ASP MVC Core project. https://github.com/sandrock/SrkToolkit/ - https://github.com/sandrock/SrkToolkit/blob/master/LICENSE + Preview 1 of SrkToolkit v2. Not ready for production; use at your own risk. SrkToolkit AspMvc AspMvcCore MVC Html NavigationLine TempData TempMessage WebDependencies AuthorizeAttribute OpenGraph DisplayDate DisplayTime 2.0.0.0 2.0.0.0 From eccaff31119d11810467756c45dd0440bf4e75d3 Mon Sep 17 00:00:00 2001 From: SandRock Date: Fri, 10 Mar 2023 15:59:06 +0100 Subject: [PATCH 06/34] SrkToolkit.Common: fix DataAnnotations, fix file links --- .../AssertTests.cs | 0 .../CompositeDisposableTests.cs | 0 .../CultureInfoHelperTests.cs | 0 .../CultureInfoAttributeTests.cs | 0 .../EmailAddressExAttributeTests.cs | 11 -- .../PhoneNumberAttributeTests.cs | 0 .../DataAnnotations/TimezoneAttributeTests.cs | 0 .../TwitterUsernameAttributeTests.cs | 0 .../DateRangeAttributeTests.cs | 0 .../DictionaryWrapperTests.cs | 0 .../DisaposableOnceTests.cs | 0 .../EmailAddressAttributeTests.cs | 36 +++--- .../EmailAddressTests.cs | 0 .../EnumStrings.Designer.cs | 0 .../EnumStrings.fr.resx | 0 .../EnumStrings.resx | 0 .../EnumToolsTests.cs | 0 .../ObservableCollectionExtensionsTests.cs | 0 .../RetryLogicTests.NET4.cs | 0 .../SrkArrayExtensionsTests.cs | 0 .../SrkDateTimeExtensionsTests.cs | 0 .../SrkIDictionaryExtensionsTests.cs | 0 .../SrkIListExtensionsTests.cs | 0 .../SrkNameValueCollectionExtensions.cs | 0 .../SrkStringExtensionsTests.cs | 0 .../SrkStringTransformer.cs | 0 .../SrkTimeZoneInfoExtensionsTests.cs | 0 .../SrkToolkit.Common.CoreUnitTests.csproj | 68 +---------- .../StringReplacerTests.cs | 0 .../ValidateTEsts.cs | 0 .../SrkToolkit.Common/CompositeDisposable.cs | 4 - .../DataAnnotations/CultureInfoAttribute.cs | 3 - .../DataAnnotations/DateRangeAttribute.cs | 3 - .../DataAnnotations/EmailAddressAttribute.cs | 23 +--- .../DataAnnotations/PhoneNumberAttribute.cs | 3 - .../DataAnnotations/TimezoneAttribute.cs | 5 +- .../TwitterUsernameAttribute.cs | 4 - Sources/SrkToolkit.Common/DisposableOnce.cs | 2 +- .../SrkToolkit.Common/Internals/Nothing.cs | 47 ++++---- .../Resources/Strings.Designer.cs | 2 +- Sources/SrkToolkit.Common/RetryLogic.cs | 111 +++++++++--------- .../SrkToolkit.Common.csproj | 10 ++ .../SrkNameValueCollectionExtensions.cs | 2 - .../SrkToolkit.Common/Validation/Validate.cs | 5 - 44 files changed, 116 insertions(+), 223 deletions(-) rename Sources/{SrkToolkit.Common.FxUnitTests => SrkToolkit.Common.CoreUnitTests}/AssertTests.cs (100%) rename Sources/{SrkToolkit.Common.FxUnitTests => SrkToolkit.Common.CoreUnitTests}/CompositeDisposableTests.cs (100%) rename Sources/{SrkToolkit.Common.FxUnitTests => SrkToolkit.Common.CoreUnitTests}/CultureInfoHelperTests.cs (100%) rename Sources/{SrkToolkit.Common.FxUnitTests => SrkToolkit.Common.CoreUnitTests}/DataAnnotations/CultureInfoAttributeTests.cs (100%) rename Sources/{SrkToolkit.Common.FxUnitTests => SrkToolkit.Common.CoreUnitTests}/DataAnnotations/EmailAddressExAttributeTests.cs (94%) rename Sources/{SrkToolkit.Common.FxUnitTests => SrkToolkit.Common.CoreUnitTests}/DataAnnotations/PhoneNumberAttributeTests.cs (100%) rename Sources/{SrkToolkit.Common.FxUnitTests => SrkToolkit.Common.CoreUnitTests}/DataAnnotations/TimezoneAttributeTests.cs (100%) rename Sources/{SrkToolkit.Common.FxUnitTests => SrkToolkit.Common.CoreUnitTests}/DataAnnotations/TwitterUsernameAttributeTests.cs (100%) rename Sources/{SrkToolkit.Common.FxUnitTests => SrkToolkit.Common.CoreUnitTests}/DateRangeAttributeTests.cs (100%) rename Sources/{SrkToolkit.Common.FxUnitTests => SrkToolkit.Common.CoreUnitTests}/DictionaryWrapperTests.cs (100%) rename Sources/{SrkToolkit.Common.FxUnitTests => SrkToolkit.Common.CoreUnitTests}/DisaposableOnceTests.cs (100%) rename Sources/{SrkToolkit.Common.FxUnitTests => SrkToolkit.Common.CoreUnitTests}/EmailAddressAttributeTests.cs (83%) rename Sources/{SrkToolkit.Common.FxUnitTests => SrkToolkit.Common.CoreUnitTests}/EmailAddressTests.cs (100%) rename Sources/{SrkToolkit.Common.FxUnitTests => SrkToolkit.Common.CoreUnitTests}/EnumStrings.Designer.cs (100%) rename Sources/{SrkToolkit.Common.FxUnitTests => SrkToolkit.Common.CoreUnitTests}/EnumStrings.fr.resx (100%) rename Sources/{SrkToolkit.Common.FxUnitTests => SrkToolkit.Common.CoreUnitTests}/EnumStrings.resx (100%) rename Sources/{SrkToolkit.Common.FxUnitTests => SrkToolkit.Common.CoreUnitTests}/EnumToolsTests.cs (100%) rename Sources/{SrkToolkit.Common.FxUnitTests => SrkToolkit.Common.CoreUnitTests}/ObservableCollectionExtensionsTests.cs (100%) rename Sources/{SrkToolkit.Common.FxUnitTests => SrkToolkit.Common.CoreUnitTests}/RetryLogicTests.NET4.cs (100%) rename Sources/{SrkToolkit.Common.FxUnitTests => SrkToolkit.Common.CoreUnitTests}/SrkArrayExtensionsTests.cs (100%) rename Sources/{SrkToolkit.Common.FxUnitTests => SrkToolkit.Common.CoreUnitTests}/SrkDateTimeExtensionsTests.cs (100%) rename Sources/{SrkToolkit.Common.FxUnitTests => SrkToolkit.Common.CoreUnitTests}/SrkIDictionaryExtensionsTests.cs (100%) rename Sources/{SrkToolkit.Common.FxUnitTests => SrkToolkit.Common.CoreUnitTests}/SrkIListExtensionsTests.cs (100%) rename Sources/{SrkToolkit.Common.FxUnitTests => SrkToolkit.Common.CoreUnitTests}/SrkNameValueCollectionExtensions.cs (100%) rename Sources/{SrkToolkit.Common.FxUnitTests => SrkToolkit.Common.CoreUnitTests}/SrkStringExtensionsTests.cs (100%) rename Sources/{SrkToolkit.Common.FxUnitTests => SrkToolkit.Common.CoreUnitTests}/SrkStringTransformer.cs (100%) rename Sources/{SrkToolkit.Common.FxUnitTests => SrkToolkit.Common.CoreUnitTests}/SrkTimeZoneInfoExtensionsTests.cs (100%) rename Sources/{SrkToolkit.Common.FxUnitTests => SrkToolkit.Common.CoreUnitTests}/StringReplacerTests.cs (100%) rename Sources/{SrkToolkit.Common.FxUnitTests => SrkToolkit.Common.CoreUnitTests}/ValidateTEsts.cs (100%) diff --git a/Sources/SrkToolkit.Common.FxUnitTests/AssertTests.cs b/Sources/SrkToolkit.Common.CoreUnitTests/AssertTests.cs similarity index 100% rename from Sources/SrkToolkit.Common.FxUnitTests/AssertTests.cs rename to Sources/SrkToolkit.Common.CoreUnitTests/AssertTests.cs diff --git a/Sources/SrkToolkit.Common.FxUnitTests/CompositeDisposableTests.cs b/Sources/SrkToolkit.Common.CoreUnitTests/CompositeDisposableTests.cs similarity index 100% rename from Sources/SrkToolkit.Common.FxUnitTests/CompositeDisposableTests.cs rename to Sources/SrkToolkit.Common.CoreUnitTests/CompositeDisposableTests.cs diff --git a/Sources/SrkToolkit.Common.FxUnitTests/CultureInfoHelperTests.cs b/Sources/SrkToolkit.Common.CoreUnitTests/CultureInfoHelperTests.cs similarity index 100% rename from Sources/SrkToolkit.Common.FxUnitTests/CultureInfoHelperTests.cs rename to Sources/SrkToolkit.Common.CoreUnitTests/CultureInfoHelperTests.cs diff --git a/Sources/SrkToolkit.Common.FxUnitTests/DataAnnotations/CultureInfoAttributeTests.cs b/Sources/SrkToolkit.Common.CoreUnitTests/DataAnnotations/CultureInfoAttributeTests.cs similarity index 100% rename from Sources/SrkToolkit.Common.FxUnitTests/DataAnnotations/CultureInfoAttributeTests.cs rename to Sources/SrkToolkit.Common.CoreUnitTests/DataAnnotations/CultureInfoAttributeTests.cs diff --git a/Sources/SrkToolkit.Common.FxUnitTests/DataAnnotations/EmailAddressExAttributeTests.cs b/Sources/SrkToolkit.Common.CoreUnitTests/DataAnnotations/EmailAddressExAttributeTests.cs similarity index 94% rename from Sources/SrkToolkit.Common.FxUnitTests/DataAnnotations/EmailAddressExAttributeTests.cs rename to Sources/SrkToolkit.Common.CoreUnitTests/DataAnnotations/EmailAddressExAttributeTests.cs index 1060d63..a4be8f4 100644 --- a/Sources/SrkToolkit.Common.FxUnitTests/DataAnnotations/EmailAddressExAttributeTests.cs +++ b/Sources/SrkToolkit.Common.CoreUnitTests/DataAnnotations/EmailAddressExAttributeTests.cs @@ -10,21 +10,10 @@ namespace SrkToolkit.Common.Tests.DataAnnotations public class EmailAddressExAttributeTests { -#if NET40 || NETFRAMEWORK -#else -#endif - -#if NET40 || NETFRAMEWORK - private static EmailAddressAttribute GetTarget() - { - return new EmailAddressAttribute(); - } -#else private static EmailAddressExAttribute GetTarget() { return new EmailAddressExAttribute(); } -#endif [Fact] public void AllowOne_NullValue_Pass() diff --git a/Sources/SrkToolkit.Common.FxUnitTests/DataAnnotations/PhoneNumberAttributeTests.cs b/Sources/SrkToolkit.Common.CoreUnitTests/DataAnnotations/PhoneNumberAttributeTests.cs similarity index 100% rename from Sources/SrkToolkit.Common.FxUnitTests/DataAnnotations/PhoneNumberAttributeTests.cs rename to Sources/SrkToolkit.Common.CoreUnitTests/DataAnnotations/PhoneNumberAttributeTests.cs diff --git a/Sources/SrkToolkit.Common.FxUnitTests/DataAnnotations/TimezoneAttributeTests.cs b/Sources/SrkToolkit.Common.CoreUnitTests/DataAnnotations/TimezoneAttributeTests.cs similarity index 100% rename from Sources/SrkToolkit.Common.FxUnitTests/DataAnnotations/TimezoneAttributeTests.cs rename to Sources/SrkToolkit.Common.CoreUnitTests/DataAnnotations/TimezoneAttributeTests.cs diff --git a/Sources/SrkToolkit.Common.FxUnitTests/DataAnnotations/TwitterUsernameAttributeTests.cs b/Sources/SrkToolkit.Common.CoreUnitTests/DataAnnotations/TwitterUsernameAttributeTests.cs similarity index 100% rename from Sources/SrkToolkit.Common.FxUnitTests/DataAnnotations/TwitterUsernameAttributeTests.cs rename to Sources/SrkToolkit.Common.CoreUnitTests/DataAnnotations/TwitterUsernameAttributeTests.cs diff --git a/Sources/SrkToolkit.Common.FxUnitTests/DateRangeAttributeTests.cs b/Sources/SrkToolkit.Common.CoreUnitTests/DateRangeAttributeTests.cs similarity index 100% rename from Sources/SrkToolkit.Common.FxUnitTests/DateRangeAttributeTests.cs rename to Sources/SrkToolkit.Common.CoreUnitTests/DateRangeAttributeTests.cs diff --git a/Sources/SrkToolkit.Common.FxUnitTests/DictionaryWrapperTests.cs b/Sources/SrkToolkit.Common.CoreUnitTests/DictionaryWrapperTests.cs similarity index 100% rename from Sources/SrkToolkit.Common.FxUnitTests/DictionaryWrapperTests.cs rename to Sources/SrkToolkit.Common.CoreUnitTests/DictionaryWrapperTests.cs diff --git a/Sources/SrkToolkit.Common.FxUnitTests/DisaposableOnceTests.cs b/Sources/SrkToolkit.Common.CoreUnitTests/DisaposableOnceTests.cs similarity index 100% rename from Sources/SrkToolkit.Common.FxUnitTests/DisaposableOnceTests.cs rename to Sources/SrkToolkit.Common.CoreUnitTests/DisaposableOnceTests.cs diff --git a/Sources/SrkToolkit.Common.FxUnitTests/EmailAddressAttributeTests.cs b/Sources/SrkToolkit.Common.CoreUnitTests/EmailAddressAttributeTests.cs similarity index 83% rename from Sources/SrkToolkit.Common.FxUnitTests/EmailAddressAttributeTests.cs rename to Sources/SrkToolkit.Common.CoreUnitTests/EmailAddressAttributeTests.cs index 395635d..0e30be0 100644 --- a/Sources/SrkToolkit.Common.FxUnitTests/EmailAddressAttributeTests.cs +++ b/Sources/SrkToolkit.Common.CoreUnitTests/EmailAddressAttributeTests.cs @@ -1,17 +1,16 @@  namespace SrkToolkit.Common.Tests { + using SrkToolkit.DataAnnotations; using System; using System.Collections.Generic; - using System.ComponentModel.DataAnnotations; ////using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using Xunit; - using EmailAddressAttribute = SrkToolkit.DataAnnotations.EmailAddressAttribute; + using ValidationContext = System.ComponentModel.DataAnnotations.ValidationContext; -#if NETFRAMEWORK - public class EmailAddressAttributeTests + public class EmailAddressExAttributeTests { public class SingleValidation { @@ -19,7 +18,7 @@ public class SingleValidation public void NullValue_IsValid() { string value = null, name = "Email"; - var attr = new EmailAddressAttribute(); + var attr = new EmailAddressExAttribute(); var context = new ValidationContext(new object(), null, null); context.MemberName = name; var result = attr.GetValidationResult(value, context); @@ -31,7 +30,7 @@ public void NullValue_IsValid() public void EmptyValue_IsValid() { string value = "", name = "Email"; - var attr = new EmailAddressAttribute(); + var attr = new EmailAddressExAttribute(); var context = new ValidationContext(new object(), null, null); context.MemberName = name; var result = attr.GetValidationResult(value, context); @@ -43,7 +42,7 @@ public void EmptyValue_IsValid() public void InvalidAddress_IsInvalid() { string value = "test", name = "Email"; - var attr = new EmailAddressAttribute(); + var attr = new EmailAddressExAttribute(); var context = new ValidationContext(new object(), null, null); context.MemberName = name; var result = attr.GetValidationResult(value, context); @@ -58,7 +57,7 @@ public void InvalidAddress_IsInvalid() public void ValidAddress_IsValid() { string value = "test@test.com", name = "Email"; - var attr = new EmailAddressAttribute(); + var attr = new EmailAddressExAttribute(); var context = new ValidationContext(new object(), null, null); context.MemberName = name; var result = attr.GetValidationResult(value, context); @@ -70,7 +69,7 @@ public void ValidAddress_IsValid() public void ValidTagAddress_IsValid() { string value = "test+test@test.com", name = "Email"; - var attr = new EmailAddressAttribute(); + var attr = new EmailAddressExAttribute(); var context = new ValidationContext(new object(), null, null); context.MemberName = name; var result = attr.GetValidationResult(value, context); @@ -82,7 +81,7 @@ public void ValidTagAddress_IsValid() public void ValidParisAddress_IsValid() { string value = "test@test.paris", name = "Email"; - var attr = new EmailAddressAttribute(); + var attr = new EmailAddressExAttribute(); var context = new ValidationContext(new object(), null, null); context.MemberName = name; var result = attr.GetValidationResult(value, context); @@ -97,7 +96,7 @@ public class MultiValidation public void NullValue_IsValid() { string value = null; - var attr = new EmailAddressAttribute() + var attr = new EmailAddressExAttribute() { AllowMultiple = true, }; @@ -111,7 +110,7 @@ public void NullValue_IsValid() public void EmptyValue_IsValid() { string value = ""; - var attr = new EmailAddressAttribute() + var attr = new EmailAddressExAttribute() { AllowMultiple = true, }; @@ -125,7 +124,7 @@ public void EmptyValue_IsValid() public void InvalidAddress_IsValid() { string value = "test"; - var attr = new EmailAddressAttribute() + var attr = new EmailAddressExAttribute() { AllowMultiple = true, }; @@ -138,7 +137,7 @@ public void InvalidAddress_IsValid() public void ValidAddress_IsValid() { string value = "test@test.com"; - var attr = new EmailAddressAttribute() + var attr = new EmailAddressExAttribute() { AllowMultiple = true, }; @@ -151,7 +150,7 @@ public void ValidAddress_IsValid() public void MultiValidAddress_IsValid() { string value = "test@test.com test@test.com test@test.com cool"; - var attr = new EmailAddressAttribute() + var attr = new EmailAddressExAttribute() { AllowMultiple = true, }; @@ -164,7 +163,7 @@ public void MultiValidAddress_IsValid() public void ValidTagAddress_IsValid() { string value = "test+test@test.com"; - var attr = new EmailAddressAttribute() + var attr = new EmailAddressExAttribute() { AllowMultiple = true, }; @@ -177,7 +176,7 @@ public void ValidTagAddress_IsValid() public void InvalidAddressAndMin1_IsInvalid() { string value = "test"; - var attr = new EmailAddressAttribute() + var attr = new EmailAddressExAttribute() { AllowMultiple = true, MinimumAddresses = 1, @@ -192,7 +191,7 @@ public void InvalidAddressAndMin1_IsInvalid() public void MultiValidAddressAndMax1_IsValid() { string value = "test@test.com test@test.com test@test.com cool"; - var attr = new EmailAddressAttribute() + var attr = new EmailAddressExAttribute() { AllowMultiple = true, MaximumAddresses = 1, @@ -204,5 +203,4 @@ public void MultiValidAddressAndMax1_IsValid() } } } - #endif } diff --git a/Sources/SrkToolkit.Common.FxUnitTests/EmailAddressTests.cs b/Sources/SrkToolkit.Common.CoreUnitTests/EmailAddressTests.cs similarity index 100% rename from Sources/SrkToolkit.Common.FxUnitTests/EmailAddressTests.cs rename to Sources/SrkToolkit.Common.CoreUnitTests/EmailAddressTests.cs diff --git a/Sources/SrkToolkit.Common.FxUnitTests/EnumStrings.Designer.cs b/Sources/SrkToolkit.Common.CoreUnitTests/EnumStrings.Designer.cs similarity index 100% rename from Sources/SrkToolkit.Common.FxUnitTests/EnumStrings.Designer.cs rename to Sources/SrkToolkit.Common.CoreUnitTests/EnumStrings.Designer.cs diff --git a/Sources/SrkToolkit.Common.FxUnitTests/EnumStrings.fr.resx b/Sources/SrkToolkit.Common.CoreUnitTests/EnumStrings.fr.resx similarity index 100% rename from Sources/SrkToolkit.Common.FxUnitTests/EnumStrings.fr.resx rename to Sources/SrkToolkit.Common.CoreUnitTests/EnumStrings.fr.resx diff --git a/Sources/SrkToolkit.Common.FxUnitTests/EnumStrings.resx b/Sources/SrkToolkit.Common.CoreUnitTests/EnumStrings.resx similarity index 100% rename from Sources/SrkToolkit.Common.FxUnitTests/EnumStrings.resx rename to Sources/SrkToolkit.Common.CoreUnitTests/EnumStrings.resx diff --git a/Sources/SrkToolkit.Common.FxUnitTests/EnumToolsTests.cs b/Sources/SrkToolkit.Common.CoreUnitTests/EnumToolsTests.cs similarity index 100% rename from Sources/SrkToolkit.Common.FxUnitTests/EnumToolsTests.cs rename to Sources/SrkToolkit.Common.CoreUnitTests/EnumToolsTests.cs diff --git a/Sources/SrkToolkit.Common.FxUnitTests/ObservableCollectionExtensionsTests.cs b/Sources/SrkToolkit.Common.CoreUnitTests/ObservableCollectionExtensionsTests.cs similarity index 100% rename from Sources/SrkToolkit.Common.FxUnitTests/ObservableCollectionExtensionsTests.cs rename to Sources/SrkToolkit.Common.CoreUnitTests/ObservableCollectionExtensionsTests.cs diff --git a/Sources/SrkToolkit.Common.FxUnitTests/RetryLogicTests.NET4.cs b/Sources/SrkToolkit.Common.CoreUnitTests/RetryLogicTests.NET4.cs similarity index 100% rename from Sources/SrkToolkit.Common.FxUnitTests/RetryLogicTests.NET4.cs rename to Sources/SrkToolkit.Common.CoreUnitTests/RetryLogicTests.NET4.cs diff --git a/Sources/SrkToolkit.Common.FxUnitTests/SrkArrayExtensionsTests.cs b/Sources/SrkToolkit.Common.CoreUnitTests/SrkArrayExtensionsTests.cs similarity index 100% rename from Sources/SrkToolkit.Common.FxUnitTests/SrkArrayExtensionsTests.cs rename to Sources/SrkToolkit.Common.CoreUnitTests/SrkArrayExtensionsTests.cs diff --git a/Sources/SrkToolkit.Common.FxUnitTests/SrkDateTimeExtensionsTests.cs b/Sources/SrkToolkit.Common.CoreUnitTests/SrkDateTimeExtensionsTests.cs similarity index 100% rename from Sources/SrkToolkit.Common.FxUnitTests/SrkDateTimeExtensionsTests.cs rename to Sources/SrkToolkit.Common.CoreUnitTests/SrkDateTimeExtensionsTests.cs diff --git a/Sources/SrkToolkit.Common.FxUnitTests/SrkIDictionaryExtensionsTests.cs b/Sources/SrkToolkit.Common.CoreUnitTests/SrkIDictionaryExtensionsTests.cs similarity index 100% rename from Sources/SrkToolkit.Common.FxUnitTests/SrkIDictionaryExtensionsTests.cs rename to Sources/SrkToolkit.Common.CoreUnitTests/SrkIDictionaryExtensionsTests.cs diff --git a/Sources/SrkToolkit.Common.FxUnitTests/SrkIListExtensionsTests.cs b/Sources/SrkToolkit.Common.CoreUnitTests/SrkIListExtensionsTests.cs similarity index 100% rename from Sources/SrkToolkit.Common.FxUnitTests/SrkIListExtensionsTests.cs rename to Sources/SrkToolkit.Common.CoreUnitTests/SrkIListExtensionsTests.cs diff --git a/Sources/SrkToolkit.Common.FxUnitTests/SrkNameValueCollectionExtensions.cs b/Sources/SrkToolkit.Common.CoreUnitTests/SrkNameValueCollectionExtensions.cs similarity index 100% rename from Sources/SrkToolkit.Common.FxUnitTests/SrkNameValueCollectionExtensions.cs rename to Sources/SrkToolkit.Common.CoreUnitTests/SrkNameValueCollectionExtensions.cs diff --git a/Sources/SrkToolkit.Common.FxUnitTests/SrkStringExtensionsTests.cs b/Sources/SrkToolkit.Common.CoreUnitTests/SrkStringExtensionsTests.cs similarity index 100% rename from Sources/SrkToolkit.Common.FxUnitTests/SrkStringExtensionsTests.cs rename to Sources/SrkToolkit.Common.CoreUnitTests/SrkStringExtensionsTests.cs diff --git a/Sources/SrkToolkit.Common.FxUnitTests/SrkStringTransformer.cs b/Sources/SrkToolkit.Common.CoreUnitTests/SrkStringTransformer.cs similarity index 100% rename from Sources/SrkToolkit.Common.FxUnitTests/SrkStringTransformer.cs rename to Sources/SrkToolkit.Common.CoreUnitTests/SrkStringTransformer.cs diff --git a/Sources/SrkToolkit.Common.FxUnitTests/SrkTimeZoneInfoExtensionsTests.cs b/Sources/SrkToolkit.Common.CoreUnitTests/SrkTimeZoneInfoExtensionsTests.cs similarity index 100% rename from Sources/SrkToolkit.Common.FxUnitTests/SrkTimeZoneInfoExtensionsTests.cs rename to Sources/SrkToolkit.Common.CoreUnitTests/SrkTimeZoneInfoExtensionsTests.cs diff --git a/Sources/SrkToolkit.Common.CoreUnitTests/SrkToolkit.Common.CoreUnitTests.csproj b/Sources/SrkToolkit.Common.CoreUnitTests/SrkToolkit.Common.CoreUnitTests.csproj index 7b3ccd0..0d5ec7f 100644 --- a/Sources/SrkToolkit.Common.CoreUnitTests/SrkToolkit.Common.CoreUnitTests.csproj +++ b/Sources/SrkToolkit.Common.CoreUnitTests/SrkToolkit.Common.CoreUnitTests.csproj @@ -11,6 +11,7 @@ + runtime; build; native; contentfiles; analyzers; buildtransitive @@ -27,73 +28,10 @@ - - AssertTests.cs - - - CompositeDisposableTests.cs - - - CultureInfoHelperTests.cs - - - DictionaryWrapperTests.cs - - - DisaposableOnceTests.cs - - - EmailAddressTests.cs - - - EnumStrings.Designer.cs - - - EnumToolsTests.cs - - - ObservableCollectionExtensionsTests.cs - - - SrkArrayExtensionsTests.cs - - - SrkDateTimeExtensionsTests.cs - - - SrkIDictionaryExtensionsTests.cs - - - SrkIListExtensionsTests.cs - - - SrkNameValueCollectionExtensions.cs - - - SrkStringExtensionsTests.cs - - - SrkStringTransformer.cs - - - SrkTimeZoneInfoExtensionsTests.cs - - - StringReplacerTests.cs - - - ValidateTEsts.cs - - - - - - EnumStrings.fr.resx - - - EnumStrings.resx + PublicResXFileCodeGenerator + diff --git a/Sources/SrkToolkit.Common.FxUnitTests/StringReplacerTests.cs b/Sources/SrkToolkit.Common.CoreUnitTests/StringReplacerTests.cs similarity index 100% rename from Sources/SrkToolkit.Common.FxUnitTests/StringReplacerTests.cs rename to Sources/SrkToolkit.Common.CoreUnitTests/StringReplacerTests.cs diff --git a/Sources/SrkToolkit.Common.FxUnitTests/ValidateTEsts.cs b/Sources/SrkToolkit.Common.CoreUnitTests/ValidateTEsts.cs similarity index 100% rename from Sources/SrkToolkit.Common.FxUnitTests/ValidateTEsts.cs rename to Sources/SrkToolkit.Common.CoreUnitTests/ValidateTEsts.cs diff --git a/Sources/SrkToolkit.Common/CompositeDisposable.cs b/Sources/SrkToolkit.Common/CompositeDisposable.cs index 78f6390..ee63a6a 100644 --- a/Sources/SrkToolkit.Common/CompositeDisposable.cs +++ b/Sources/SrkToolkit.Common/CompositeDisposable.cs @@ -55,8 +55,6 @@ public void Add(IDisposable disposable) this.collection.Add(new WeakReference(disposable)); } - #region IDisposable members - /// /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// @@ -95,7 +93,5 @@ private void Dispose(bool disposing) }); } } - - #endregion } } diff --git a/Sources/SrkToolkit.Common/DataAnnotations/CultureInfoAttribute.cs b/Sources/SrkToolkit.Common/DataAnnotations/CultureInfoAttribute.cs index 3945c11..0b70c3a 100644 --- a/Sources/SrkToolkit.Common/DataAnnotations/CultureInfoAttribute.cs +++ b/Sources/SrkToolkit.Common/DataAnnotations/CultureInfoAttribute.cs @@ -14,8 +14,6 @@ // limitations under the License. // -#if NETFRAMEWORK - namespace SrkToolkit.DataAnnotations { using System; @@ -86,4 +84,3 @@ public override bool IsValid(object value) } } } -#endif diff --git a/Sources/SrkToolkit.Common/DataAnnotations/DateRangeAttribute.cs b/Sources/SrkToolkit.Common/DataAnnotations/DateRangeAttribute.cs index 0587cf2..2eec443 100644 --- a/Sources/SrkToolkit.Common/DataAnnotations/DateRangeAttribute.cs +++ b/Sources/SrkToolkit.Common/DataAnnotations/DateRangeAttribute.cs @@ -14,8 +14,6 @@ // limitations under the License. // -#if NETFRAMEWORK - namespace SrkToolkit.DataAnnotations { using System; @@ -163,4 +161,3 @@ public override string FormatErrorMessage(string name) } } } -#endif diff --git a/Sources/SrkToolkit.Common/DataAnnotations/EmailAddressAttribute.cs b/Sources/SrkToolkit.Common/DataAnnotations/EmailAddressAttribute.cs index 42b410d..8d7c44f 100644 --- a/Sources/SrkToolkit.Common/DataAnnotations/EmailAddressAttribute.cs +++ b/Sources/SrkToolkit.Common/DataAnnotations/EmailAddressAttribute.cs @@ -18,14 +18,11 @@ namespace SrkToolkit.DataAnnotations { using SrkToolkit.Resources; using System; + using System.ComponentModel.DataAnnotations; using System.Globalization; using System.Reflection; using System.Text.RegularExpressions; -#if NET40 || NETFRAMEWORK - using System.ComponentModel.DataAnnotations; -#endif - // This namespace is hard to support with multi-framework // NET40: reference to System.ComponentModel.DataAnnotations // NET46: nuget? @@ -34,15 +31,7 @@ namespace SrkToolkit.DataAnnotations /// /// Validates an email address field (one or multiple addresses). /// -#if NET40 - [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)] - public class EmailAddressAttribute : ValidationAttribute -#elif NETFRAMEWORK - [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)] public class EmailAddressExAttribute : ValidationAttribute -#else - public class EmailAddressExAttribute -#endif { /// /// The regex pattern to match an email address. @@ -54,17 +43,11 @@ public class EmailAddressExAttribute /// /// Initializes a new instance of the class. /// -#if NET40 || NETFRAMEWORK - public EmailAddressAttribute() + public EmailAddressExAttribute() { this.ErrorMessageResourceName = "EmailAddressAttribute_ErrorMessage"; this.ErrorMessageResourceType = typeof(Strings); } -#else - public EmailAddressExAttribute() - { - } -#endif /// /// Gets or sets a value indicating whether to allow multiple addresses in a single field. Default is false. Use to parse addresses. @@ -89,7 +72,6 @@ public EmailAddressExAttribute() /// protected Regex Regex { get; set; } -#if NET40 || NETFRAMEWORK /// /// Validates the specified value with respect to the current validation attribute. /// @@ -229,6 +211,5 @@ public ValidationResult GetIsValid(object value, ValidationContext context) { return this.IsValid(value, context); } -#endif } } diff --git a/Sources/SrkToolkit.Common/DataAnnotations/PhoneNumberAttribute.cs b/Sources/SrkToolkit.Common/DataAnnotations/PhoneNumberAttribute.cs index 69e478b..af7b0af 100644 --- a/Sources/SrkToolkit.Common/DataAnnotations/PhoneNumberAttribute.cs +++ b/Sources/SrkToolkit.Common/DataAnnotations/PhoneNumberAttribute.cs @@ -14,8 +14,6 @@ // limitations under the License. // -#if NETFRAMEWORK - namespace SrkToolkit.DataAnnotations { using SrkToolkit.Resources; @@ -89,4 +87,3 @@ public static bool ConvertNationalToInternational(string value, CultureInfo cult } } } -#endif diff --git a/Sources/SrkToolkit.Common/DataAnnotations/TimezoneAttribute.cs b/Sources/SrkToolkit.Common/DataAnnotations/TimezoneAttribute.cs index cc0855e..7fef5dd 100644 --- a/Sources/SrkToolkit.Common/DataAnnotations/TimezoneAttribute.cs +++ b/Sources/SrkToolkit.Common/DataAnnotations/TimezoneAttribute.cs @@ -14,16 +14,14 @@ // limitations under the License. // -#if NETFRAMEWORK - namespace SrkToolkit.DataAnnotations { + using SrkToolkit.Resources; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; - using SrkToolkit.Resources; // TODO: support for netstandard @@ -72,4 +70,3 @@ public override bool IsValid(object value) } } } -#endif diff --git a/Sources/SrkToolkit.Common/DataAnnotations/TwitterUsernameAttribute.cs b/Sources/SrkToolkit.Common/DataAnnotations/TwitterUsernameAttribute.cs index 7685540..252303d 100644 --- a/Sources/SrkToolkit.Common/DataAnnotations/TwitterUsernameAttribute.cs +++ b/Sources/SrkToolkit.Common/DataAnnotations/TwitterUsernameAttribute.cs @@ -14,8 +14,6 @@ // limitations under the License. // -#if NETFRAMEWORK - namespace SrkToolkit.DataAnnotations { using SrkToolkit.Resources; @@ -24,7 +22,6 @@ namespace SrkToolkit.DataAnnotations using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text.RegularExpressions; - using System.Web; // TODO: support for netstandard @@ -76,4 +73,3 @@ public static bool GetUsername(string value, out string username) } } } -#endif diff --git a/Sources/SrkToolkit.Common/DisposableOnce.cs b/Sources/SrkToolkit.Common/DisposableOnce.cs index fefc446..c90f80a 100644 --- a/Sources/SrkToolkit.Common/DisposableOnce.cs +++ b/Sources/SrkToolkit.Common/DisposableOnce.cs @@ -24,7 +24,7 @@ namespace SrkToolkit using SrkToolkit.Internals; /// - /// A disposable object that will cann a delegate on disposal. + /// A disposable object that will call a delegate on disposal. /// public sealed class DisposableOnce : IDisposable { diff --git a/Sources/SrkToolkit.Common/Internals/Nothing.cs b/Sources/SrkToolkit.Common/Internals/Nothing.cs index 6a82a39..269b364 100644 --- a/Sources/SrkToolkit.Common/Internals/Nothing.cs +++ b/Sources/SrkToolkit.Common/Internals/Nothing.cs @@ -1,22 +1,25 @@ -// -// Copyright 2014 SandRock -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace SrkToolkit.Internals -{ - public sealed class Nothing - { - } -} +// +// Copyright 2014 SandRock +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +namespace SrkToolkit.Internals +{ + /// + /// An empty class with a meaningful name. + /// + public sealed class Nothing + { + } +} diff --git a/Sources/SrkToolkit.Common/Resources/Strings.Designer.cs b/Sources/SrkToolkit.Common/Resources/Strings.Designer.cs index 4b8acd6..a8b5bf0 100644 --- a/Sources/SrkToolkit.Common/Resources/Strings.Designer.cs +++ b/Sources/SrkToolkit.Common/Resources/Strings.Designer.cs @@ -38,7 +38,7 @@ internal Strings() { public static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SrkToolkit.Common.Resources.Strings", typeof(Strings).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SrkToolkit.Resources.Strings", typeof(Strings).Assembly); resourceMan = temp; } return resourceMan; diff --git a/Sources/SrkToolkit.Common/RetryLogic.cs b/Sources/SrkToolkit.Common/RetryLogic.cs index 70f8574..5e3ad3f 100644 --- a/Sources/SrkToolkit.Common/RetryLogic.cs +++ b/Sources/SrkToolkit.Common/RetryLogic.cs @@ -1,55 +1,56 @@ -// -// Copyright 2014 SandRock, pyDez -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace SrkToolkit -{ - using SrkToolkit.Internals; - using System; - using System.Collections.Generic; - using System.Linq; - using System.Threading.Tasks; - - // TODO: support for netstandard - - public static class RetryLogic - { - static public RetryLogicState Do(Func action) - { - return new RetryLogicState(action); - } - - static public RetryLogicState Do(Action action) - { - return new RetryLogicState(action); - } -#if NET45 - static public RetryLogicState DoAsync(Func> action) - { - return new RetryLogicState(action); - } - - static public RetryLogicState DoAsync(Func action) - { - return new RetryLogicState(action); - } -#endif - - static public RetryLogicState BeginPrepare() - { - return RetryLogicState.BeginPrepare(); - } - } -} +// +// Copyright 2014 SandRock, pyDez +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +namespace SrkToolkit +{ + using SrkToolkit.Internals; + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + + // TODO: support for netstandard + + [Obsolete("Use a proper code library for that")] + public static class RetryLogic + { + static public RetryLogicState Do(Func action) + { + return new RetryLogicState(action); + } + + static public RetryLogicState Do(Action action) + { + return new RetryLogicState(action); + } +#if NET45 + static public RetryLogicState DoAsync(Func> action) + { + return new RetryLogicState(action); + } + + static public RetryLogicState DoAsync(Func action) + { + return new RetryLogicState(action); + } +#endif + + static public RetryLogicState BeginPrepare() + { + return RetryLogicState.BeginPrepare(); + } + } +} diff --git a/Sources/SrkToolkit.Common/SrkToolkit.Common.csproj b/Sources/SrkToolkit.Common/SrkToolkit.Common.csproj index e72646a..3954268 100644 --- a/Sources/SrkToolkit.Common/SrkToolkit.Common.csproj +++ b/Sources/SrkToolkit.Common/SrkToolkit.Common.csproj @@ -17,6 +17,7 @@ 2.0.0.0 true ..\SrkToolkit.snk + SrkToolkit @@ -32,7 +33,16 @@ PublicResXFileCodeGenerator + SrkToolkit.Resources + + + + + + + + diff --git a/Sources/SrkToolkit.Common/System.Collections.Specialized/SrkNameValueCollectionExtensions.cs b/Sources/SrkToolkit.Common/System.Collections.Specialized/SrkNameValueCollectionExtensions.cs index 48457e6..a54fdc9 100644 --- a/Sources/SrkToolkit.Common/System.Collections.Specialized/SrkNameValueCollectionExtensions.cs +++ b/Sources/SrkToolkit.Common/System.Collections.Specialized/SrkNameValueCollectionExtensions.cs @@ -21,7 +21,6 @@ namespace System.Collections.Specialized using System.Linq; using System.Text; -#if !NSTD /// /// Extension methods for the class. /// @@ -56,5 +55,4 @@ public static IEnumerable> AsEnumerable(this NameVa } } } -#endif } diff --git a/Sources/SrkToolkit.Common/Validation/Validate.cs b/Sources/SrkToolkit.Common/Validation/Validate.cs index 533fa6d..2914286 100644 --- a/Sources/SrkToolkit.Common/Validation/Validate.cs +++ b/Sources/SrkToolkit.Common/Validation/Validate.cs @@ -26,13 +26,8 @@ namespace SrkToolkit.Common.Validation /// public static class Validate { -#if NET40 - private static readonly Regex emailRegex = new Regex(@"^" + EmailAddressAttribute.EmailAddressRegex + "$", RegexOptions.IgnoreCase); - private static readonly Regex emailsRegex = new Regex(EmailAddressAttribute.EmailAddressRegex, RegexOptions.IgnoreCase); -#else private static readonly Regex emailRegex = new Regex(@"^" + EmailAddressExAttribute.EmailAddressRegex + "$", RegexOptions.IgnoreCase); private static readonly Regex emailsRegex = new Regex(EmailAddressExAttribute.EmailAddressRegex, RegexOptions.IgnoreCase); -#endif private static readonly Regex regexCaptureBracket = new Regex(@"\(.*\)", RegexOptions.Compiled); /// From 598436aa499ac914cf79d0bf227b420b7af11d80 Mon Sep 17 00:00:00 2001 From: SandRock Date: Fri, 10 Mar 2023 16:01:25 +0100 Subject: [PATCH 07/34] SrkToolkit.Common: v2.0.145-preview1 --- Package/version.txt | 2 +- Sources/SrkToolkit.Common/SrkToolkit.Common.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Package/version.txt b/Package/version.txt index 3ae35be..9576870 100644 --- a/Package/version.txt +++ b/Package/version.txt @@ -1 +1 @@ -2.0.144 \ No newline at end of file +2.0.145 \ No newline at end of file diff --git a/Sources/SrkToolkit.Common/SrkToolkit.Common.csproj b/Sources/SrkToolkit.Common/SrkToolkit.Common.csproj index 3954268..6e0a1cc 100644 --- a/Sources/SrkToolkit.Common/SrkToolkit.Common.csproj +++ b/Sources/SrkToolkit.Common/SrkToolkit.Common.csproj @@ -6,7 +6,7 @@ net40;net7.0;netstandard2.0 9 true - 2.0.144-preview1 + 2.0.145-preview1 SandRock, pyDez Apache-2.0 SrkToolkit.Common contains various extension methods, validators and utility classes. From e0b2bf751d8ef36802f5a857f4cf7de6b43e70b4 Mon Sep 17 00:00:00 2001 From: SandRock Date: Fri, 10 Mar 2023 18:16:46 +0100 Subject: [PATCH 08/34] SrkToolkit.Web: preserve old namespaces --- Sources/SrkToolkit.Web.AspNetCore2/Fakes/Dummy.cs | 9 +++++++++ Sources/SrkToolkit.Web.AspNetCore2/Filters/Dummy.cs | 9 +++++++++ Sources/SrkToolkit.Web.AspNetCore2/HttpErrors/Dummy.cs | 9 +++++++++ .../SrkToolkit.Web.AspNetCore2.csproj | 5 ----- 4 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 Sources/SrkToolkit.Web.AspNetCore2/Fakes/Dummy.cs create mode 100644 Sources/SrkToolkit.Web.AspNetCore2/Filters/Dummy.cs create mode 100644 Sources/SrkToolkit.Web.AspNetCore2/HttpErrors/Dummy.cs diff --git a/Sources/SrkToolkit.Web.AspNetCore2/Fakes/Dummy.cs b/Sources/SrkToolkit.Web.AspNetCore2/Fakes/Dummy.cs new file mode 100644 index 0000000..935dc97 --- /dev/null +++ b/Sources/SrkToolkit.Web.AspNetCore2/Fakes/Dummy.cs @@ -0,0 +1,9 @@ + +namespace SrkToolkit.Web.Fakes; + +using System; + +/// +/// Preserve the namespace. +/// +public static class Dummy { } diff --git a/Sources/SrkToolkit.Web.AspNetCore2/Filters/Dummy.cs b/Sources/SrkToolkit.Web.AspNetCore2/Filters/Dummy.cs new file mode 100644 index 0000000..5e543c1 --- /dev/null +++ b/Sources/SrkToolkit.Web.AspNetCore2/Filters/Dummy.cs @@ -0,0 +1,9 @@ + +namespace SrkToolkit.Web.Filters; + +using System; + +/// +/// Preserve the namespace. +/// +public static class Dummy { } diff --git a/Sources/SrkToolkit.Web.AspNetCore2/HttpErrors/Dummy.cs b/Sources/SrkToolkit.Web.AspNetCore2/HttpErrors/Dummy.cs new file mode 100644 index 0000000..4073bbd --- /dev/null +++ b/Sources/SrkToolkit.Web.AspNetCore2/HttpErrors/Dummy.cs @@ -0,0 +1,9 @@ + +namespace SrkToolkit.Web.HttpErrors; + +using System; + +/// +/// Preserve the namespace. +/// +public static class Dummy { } diff --git a/Sources/SrkToolkit.Web.AspNetCore2/SrkToolkit.Web.AspNetCore2.csproj b/Sources/SrkToolkit.Web.AspNetCore2/SrkToolkit.Web.AspNetCore2.csproj index 63d65fc..64b0677 100644 --- a/Sources/SrkToolkit.Web.AspNetCore2/SrkToolkit.Web.AspNetCore2.csproj +++ b/Sources/SrkToolkit.Web.AspNetCore2/SrkToolkit.Web.AspNetCore2.csproj @@ -42,11 +42,6 @@ - - - - - Open\NavigationLine.cs From 294e21c0eb1cd5fc6ba43aad0b5c9fb0b59ed403 Mon Sep 17 00:00:00 2001 From: SandRock Date: Fri, 10 Mar 2023 18:17:09 +0100 Subject: [PATCH 09/34] SrkToolkit.Domain: fix EnumTool being public --- Sources/SrkToolkit.Common/EnumTools.cs | 5 +++-- Sources/SrkToolkit.Domain/SrkToolkit.Domain.csproj | 8 ++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Sources/SrkToolkit.Common/EnumTools.cs b/Sources/SrkToolkit.Common/EnumTools.cs index 029ffc7..08064a3 100644 --- a/Sources/SrkToolkit.Common/EnumTools.cs +++ b/Sources/SrkToolkit.Common/EnumTools.cs @@ -31,10 +31,11 @@ namespace SrkToolkit /// Helps you work with enums. /// #if ASS_DOMAIN - internal static class EnumTools + internal #else - public static class EnumTools + public #endif + static class EnumTools { /// /// Gets the description of a enum value from a resource file. diff --git a/Sources/SrkToolkit.Domain/SrkToolkit.Domain.csproj b/Sources/SrkToolkit.Domain/SrkToolkit.Domain.csproj index c2e794a..38c229b 100644 --- a/Sources/SrkToolkit.Domain/SrkToolkit.Domain.csproj +++ b/Sources/SrkToolkit.Domain/SrkToolkit.Domain.csproj @@ -19,6 +19,14 @@ ..\SrkToolkit.snk + + TRACE;ASS_DOMAIN + + + + TRACE;ASS_DOMAIN + + SrkToolkit.snk From 35805f9375c95518db7fc1bc9d05e1be030dbef6 Mon Sep 17 00:00:00 2001 From: SandRock Date: Fri, 10 Mar 2023 18:20:52 +0100 Subject: [PATCH 10/34] nuget: set icon --- Sources/SrkToolkit.Common/SrkToolkit.Common.csproj | 6 ++++++ .../SrkToolkit.Domain.AspNetCore2.csproj | 8 +++++++- Sources/SrkToolkit.Domain/SrkToolkit.Domain.csproj | 8 +++++++- .../SrkToolkit.Web.AspNetCore2.csproj | 8 +++++++- 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/Sources/SrkToolkit.Common/SrkToolkit.Common.csproj b/Sources/SrkToolkit.Common/SrkToolkit.Common.csproj index 6e0a1cc..9d30a5d 100644 --- a/Sources/SrkToolkit.Common/SrkToolkit.Common.csproj +++ b/Sources/SrkToolkit.Common/SrkToolkit.Common.csproj @@ -18,6 +18,7 @@ true ..\SrkToolkit.snk SrkToolkit + logo-200.png @@ -25,6 +26,11 @@ + + True + + logo-200.png + SrkToolkit.snk diff --git a/Sources/SrkToolkit.Domain.AspNetCore2/SrkToolkit.Domain.AspNetCore2.csproj b/Sources/SrkToolkit.Domain.AspNetCore2/SrkToolkit.Domain.AspNetCore2.csproj index 83a9e92..4b85f0e 100644 --- a/Sources/SrkToolkit.Domain.AspNetCore2/SrkToolkit.Domain.AspNetCore2.csproj +++ b/Sources/SrkToolkit.Domain.AspNetCore2/SrkToolkit.Domain.AspNetCore2.csproj @@ -6,13 +6,14 @@ enable SrkToolkit.Domain.AspNetCore2 true - 2.0.144-preview1 + 2.0.145-preview1 SandRock Apache-2.0 SrkToolkit.Domain.AspNetCore2 contains extension methods for SrkToolkit.Domain in the context of a ASP MVC Core application. https://github.com/sandrock/SrkToolkit/ Preview 1 of SrkToolkit v2. Not ready for production; use at your own risk. SrkToolkit domain AspMvcCore + logo-200.png 2.0.0.0 2.0.0.0 true @@ -20,6 +21,11 @@ + + True + + logo-200.png + SrkToolkit.snk diff --git a/Sources/SrkToolkit.Domain/SrkToolkit.Domain.csproj b/Sources/SrkToolkit.Domain/SrkToolkit.Domain.csproj index 38c229b..4bec65c 100644 --- a/Sources/SrkToolkit.Domain/SrkToolkit.Domain.csproj +++ b/Sources/SrkToolkit.Domain/SrkToolkit.Domain.csproj @@ -6,13 +6,14 @@ net46;net7.0;netstandard2.0 9 true - 2.0.144-preview1 + 2.0.145-preview1 SandRock Apache-2.0 SrkToolkit.Domain is used in your domain layer to provider RPC-style request and result classes. https://github.com/sandrock/SrkToolkit/ Preview 1 of SrkToolkit v2. Not ready for production; use at your own risk. SrkToolkit domain + logo-200.png 2.0.0.0 2.0.0.0 true @@ -28,6 +29,11 @@ + + True + + logo-200.png + SrkToolkit.snk diff --git a/Sources/SrkToolkit.Web.AspNetCore2/SrkToolkit.Web.AspNetCore2.csproj b/Sources/SrkToolkit.Web.AspNetCore2/SrkToolkit.Web.AspNetCore2.csproj index 64b0677..8af47c9 100644 --- a/Sources/SrkToolkit.Web.AspNetCore2/SrkToolkit.Web.AspNetCore2.csproj +++ b/Sources/SrkToolkit.Web.AspNetCore2/SrkToolkit.Web.AspNetCore2.csproj @@ -6,13 +6,14 @@ default SrkToolkit.Web.AspNetCore2 true - 2.0.144-preview1 + 2.0.145-preview1 SandRock Apache-2.0 SrkToolkit.Web.AspNetCore2 is a bunch of extensions and components to use with your ASP MVC Core project. https://github.com/sandrock/SrkToolkit/ Preview 1 of SrkToolkit v2. Not ready for production; use at your own risk. SrkToolkit AspMvc AspMvcCore MVC Html NavigationLine TempData TempMessage WebDependencies AuthorizeAttribute OpenGraph DisplayDate DisplayTime + logo-200.png 2.0.0.0 2.0.0.0 true @@ -28,6 +29,11 @@ + + True + + logo-200.png + SrkToolkit.snk From 29e2fd4f4386bb52cc117a9200065c243629a566 Mon Sep 17 00:00:00 2001 From: SandRock Date: Fri, 10 Mar 2023 18:43:25 +0100 Subject: [PATCH 11/34] SrkToolkit.Web.AspNetCore2: fixed many problems --- .../SrkMvcCollectionExtensionsTests.cs | 1 - .../Models}/NavigationLine.cs | 2 +- .../Models}/NavigationLineEntry.cs | 2 +- .../SrkControllerExtensions.cs | 1 + .../SrkHtmlExtensions.cs | 3 ++- .../SrkMvcCollectionExtensions.cs | 2 +- .../SrkTagBuilderExtensions.cs | 15 ++++++++++++--- .../SrkToolkit.Web.AspNetCore2.csproj | 18 +++++++++--------- .../SrkUrlHelperExtensions.cs | 2 +- .../{System.Web.Mvc => }/SrkViewExtensions.cs | 2 +- 10 files changed, 29 insertions(+), 19 deletions(-) rename Sources/{SrkToolkit.Web.AspMvc5 => SrkToolkit.Web.AspNetCore2/Models}/NavigationLine.cs (94%) rename Sources/{SrkToolkit.Web.AspMvc5 => SrkToolkit.Web.AspNetCore2/Models}/NavigationLineEntry.cs (94%) rename Sources/SrkToolkit.Web.AspNetCore2/{System.Web.Mvc => }/SrkMvcCollectionExtensions.cs (96%) rename Sources/SrkToolkit.Web.AspNetCore2/{System.Web.Mvc => }/SrkTagBuilderExtensions.cs (80%) rename Sources/SrkToolkit.Web.AspNetCore2/{System.Web.Mvc => }/SrkUrlHelperExtensions.cs (97%) rename Sources/SrkToolkit.Web.AspNetCore2/{System.Web.Mvc => }/SrkViewExtensions.cs (95%) diff --git a/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkMvcCollectionExtensionsTests.cs b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkMvcCollectionExtensionsTests.cs index ab37473..5802758 100644 --- a/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkMvcCollectionExtensionsTests.cs +++ b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkMvcCollectionExtensionsTests.cs @@ -21,7 +21,6 @@ namespace SrkToolkit.Web.Tests using System.Collections.Generic; using System.Linq; using System.Text; - using System.Web.Mvc; using Xunit; public class SrkMvcCollectionExtensionsTests diff --git a/Sources/SrkToolkit.Web.AspMvc5/NavigationLine.cs b/Sources/SrkToolkit.Web.AspNetCore2/Models/NavigationLine.cs similarity index 94% rename from Sources/SrkToolkit.Web.AspMvc5/NavigationLine.cs rename to Sources/SrkToolkit.Web.AspNetCore2/Models/NavigationLine.cs index 35d09ad..13ad59d 100644 --- a/Sources/SrkToolkit.Web.AspMvc5/NavigationLine.cs +++ b/Sources/SrkToolkit.Web.AspNetCore2/Models/NavigationLine.cs @@ -14,7 +14,7 @@ // limitations under the License. // -namespace SrkToolkit.Web.Open +namespace SrkToolkit.Web.Models { using System; using System.Collections.Generic; diff --git a/Sources/SrkToolkit.Web.AspMvc5/NavigationLineEntry.cs b/Sources/SrkToolkit.Web.AspNetCore2/Models/NavigationLineEntry.cs similarity index 94% rename from Sources/SrkToolkit.Web.AspMvc5/NavigationLineEntry.cs rename to Sources/SrkToolkit.Web.AspNetCore2/Models/NavigationLineEntry.cs index b83b589..4df2323 100644 --- a/Sources/SrkToolkit.Web.AspMvc5/NavigationLineEntry.cs +++ b/Sources/SrkToolkit.Web.AspNetCore2/Models/NavigationLineEntry.cs @@ -14,7 +14,7 @@ // limitations under the License. // -namespace SrkToolkit.Web.Open +namespace SrkToolkit.Web.Models { using System; using System.Collections.Generic; diff --git a/Sources/SrkToolkit.Web.AspNetCore2/SrkControllerExtensions.cs b/Sources/SrkToolkit.Web.AspNetCore2/SrkControllerExtensions.cs index f2236a8..aa89ae9 100644 --- a/Sources/SrkToolkit.Web.AspNetCore2/SrkControllerExtensions.cs +++ b/Sources/SrkToolkit.Web.AspNetCore2/SrkControllerExtensions.cs @@ -18,6 +18,7 @@ namespace SrkToolkit.Web { using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Routing; + using SrkToolkit.Web.Models; using SrkToolkit.Web.Open; using System; using System.Collections.Generic; diff --git a/Sources/SrkToolkit.Web.AspNetCore2/SrkHtmlExtensions.cs b/Sources/SrkToolkit.Web.AspNetCore2/SrkHtmlExtensions.cs index 274eda3..abe898a 100644 --- a/Sources/SrkToolkit.Web.AspNetCore2/SrkHtmlExtensions.cs +++ b/Sources/SrkToolkit.Web.AspNetCore2/SrkHtmlExtensions.cs @@ -14,7 +14,7 @@ // limitations under the License. // -namespace System.Web.Mvc +namespace SrkToolkit.Web { using Microsoft.AspNetCore.Html; using Microsoft.AspNetCore.Mvc.ModelBinding; @@ -24,6 +24,7 @@ namespace System.Web.Mvc using Microsoft.AspNetCore.Routing; using SrkToolkit.AspNetCore; using SrkToolkit.Web; + using SrkToolkit.Web.Models; using SrkToolkit.Web.Open; using System; using System.Collections.Generic; diff --git a/Sources/SrkToolkit.Web.AspNetCore2/System.Web.Mvc/SrkMvcCollectionExtensions.cs b/Sources/SrkToolkit.Web.AspNetCore2/SrkMvcCollectionExtensions.cs similarity index 96% rename from Sources/SrkToolkit.Web.AspNetCore2/System.Web.Mvc/SrkMvcCollectionExtensions.cs rename to Sources/SrkToolkit.Web.AspNetCore2/SrkMvcCollectionExtensions.cs index 11b7906..724157e 100644 --- a/Sources/SrkToolkit.Web.AspNetCore2/System.Web.Mvc/SrkMvcCollectionExtensions.cs +++ b/Sources/SrkToolkit.Web.AspNetCore2/SrkMvcCollectionExtensions.cs @@ -14,7 +14,7 @@ // limitations under the License. // -namespace System.Web.Mvc +namespace SrkToolkit.Web { using Microsoft.AspNetCore.Mvc.Rendering; using System; diff --git a/Sources/SrkToolkit.Web.AspNetCore2/System.Web.Mvc/SrkTagBuilderExtensions.cs b/Sources/SrkToolkit.Web.AspNetCore2/SrkTagBuilderExtensions.cs similarity index 80% rename from Sources/SrkToolkit.Web.AspNetCore2/System.Web.Mvc/SrkTagBuilderExtensions.cs rename to Sources/SrkToolkit.Web.AspNetCore2/SrkTagBuilderExtensions.cs index a00e108..acf6a3e 100644 --- a/Sources/SrkToolkit.Web.AspNetCore2/System.Web.Mvc/SrkTagBuilderExtensions.cs +++ b/Sources/SrkToolkit.Web.AspNetCore2/SrkTagBuilderExtensions.cs @@ -14,7 +14,7 @@ // limitations under the License. // -namespace System.Web.Mvc +namespace SrkToolkit.Web { using Microsoft.AspNetCore.Html; using Microsoft.AspNetCore.Mvc.Rendering; @@ -28,7 +28,7 @@ namespace System.Web.Mvc /// public static class SrkTagBuilderExtensions { -#if !NSTD && !NET40 +/* /// /// To the MVC HTML string. /// @@ -39,6 +39,15 @@ public static HtmlString ToMvcHtmlString(this TagBuilder tagBuilder, TagRenderMo { return new HtmlString(tagBuilder.ToString(renderMode)); } -#endif +*/ + public static HtmlString ToHtmlString(this TagBuilder tag) + { + if (tag == null) + { + throw new ArgumentNullException(nameof(tag)); + } + + return new HtmlString(tag.ToString()); + } } } diff --git a/Sources/SrkToolkit.Web.AspNetCore2/SrkToolkit.Web.AspNetCore2.csproj b/Sources/SrkToolkit.Web.AspNetCore2/SrkToolkit.Web.AspNetCore2.csproj index 8af47c9..bc37f93 100644 --- a/Sources/SrkToolkit.Web.AspNetCore2/SrkToolkit.Web.AspNetCore2.csproj +++ b/Sources/SrkToolkit.Web.AspNetCore2/SrkToolkit.Web.AspNetCore2.csproj @@ -4,7 +4,7 @@ netstandard2.0 enable default - SrkToolkit.Web.AspNetCore2 + SrkToolkit.Web true 2.0.145-preview1 SandRock @@ -37,6 +37,8 @@ SrkToolkit.snk + + @@ -49,12 +51,6 @@ - - Open\NavigationLine.cs - - - Open\NavigationLineEntry.cs - Open\OpenGraphName.cs @@ -87,6 +83,8 @@ + + @@ -125,9 +123,11 @@ - - + + + + diff --git a/Sources/SrkToolkit.Web.AspNetCore2/System.Web.Mvc/SrkUrlHelperExtensions.cs b/Sources/SrkToolkit.Web.AspNetCore2/SrkUrlHelperExtensions.cs similarity index 97% rename from Sources/SrkToolkit.Web.AspNetCore2/System.Web.Mvc/SrkUrlHelperExtensions.cs rename to Sources/SrkToolkit.Web.AspNetCore2/SrkUrlHelperExtensions.cs index b8d9cbf..9465cb4 100644 --- a/Sources/SrkToolkit.Web.AspNetCore2/System.Web.Mvc/SrkUrlHelperExtensions.cs +++ b/Sources/SrkToolkit.Web.AspNetCore2/SrkUrlHelperExtensions.cs @@ -14,7 +14,7 @@ // limitations under the License. // -namespace System.Web.Mvc +namespace SrkToolkit.Web { using Microsoft.AspNetCore.Mvc.Routing; using System; diff --git a/Sources/SrkToolkit.Web.AspNetCore2/System.Web.Mvc/SrkViewExtensions.cs b/Sources/SrkToolkit.Web.AspNetCore2/SrkViewExtensions.cs similarity index 95% rename from Sources/SrkToolkit.Web.AspNetCore2/System.Web.Mvc/SrkViewExtensions.cs rename to Sources/SrkToolkit.Web.AspNetCore2/SrkViewExtensions.cs index 1b22713..114a1f7 100644 --- a/Sources/SrkToolkit.Web.AspNetCore2/System.Web.Mvc/SrkViewExtensions.cs +++ b/Sources/SrkToolkit.Web.AspNetCore2/SrkViewExtensions.cs @@ -14,7 +14,7 @@ // limitations under the License. // -namespace System.Web.Mvc +namespace SrkToolkit.Web { using SrkToolkit.Web.Models; using System; From c03f2e5926b9863a9bc099f69a58d02ccf1aaa86 Mon Sep 17 00:00:00 2001 From: SandRock Date: Thu, 23 Mar 2023 11:44:42 +0100 Subject: [PATCH 12/34] SrkToolkit.Web: new DisplayTimeSpan HtmlHelper extension --- .../SrkToolkit.Web.AspNetCore2/Internals.cs | 112 ++++++++++- .../SrkHtmlExtensions.cs | 188 ++++++++++++++++-- .../SrkHttpContextExtensions.cs | 8 +- 3 files changed, 278 insertions(+), 30 deletions(-) diff --git a/Sources/SrkToolkit.Web.AspNetCore2/Internals.cs b/Sources/SrkToolkit.Web.AspNetCore2/Internals.cs index 2a32da7..b94b561 100644 --- a/Sources/SrkToolkit.Web.AspNetCore2/Internals.cs +++ b/Sources/SrkToolkit.Web.AspNetCore2/Internals.cs @@ -1,9 +1,103 @@ - -namespace SrkToolkit.Web -{ - using System; - - internal static class Internals - { - } -} + +namespace SrkToolkit.Web +{ + using System; + using System.Globalization; + + internal static class Internals + { + // source: https://gist.github.com/sandrock/6fe3298b8ac6d9d0d9872dd811a63908 + + #region ToStringExtensions + + /// + /// Returns an invariant, roundtrip-safe string representation of this value. + /// + /// + /// an invariant, roundtrip-safe string representation + internal static string ToInvariantString(this float value) + { + // Format R (roundtrip) is discouraged + // https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings#the-round-trip-r-format-specifier + // For Double values, the "R" format specifier in some cases fails to successfully round-trip the original value. For both Double and Single values, it also offers relatively poor performance. Instead, we recommend that you use the "G17" format specifier for Double values and the "G9" format specifier to successfully round-trip Single values. + return value.ToString("G9", CultureInfo.InvariantCulture); + } + + /// + /// Returns an invariant, roundtrip-safe string representation of this value. + /// + /// + /// an invariant, roundtrip-safe string representation + internal static string ToInvariantString(this double value) + { + // Format R (roundtrip) is discouraged + // https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings#the-round-trip-r-format-specifier + // For Double values, the "R" format specifier in some cases fails to successfully round-trip the original value. For both Double and Single values, it also offers relatively poor performance. Instead, we recommend that you use the "G17" format specifier for Double values and the "G9" format specifier to successfully round-trip Single values. + return value.ToString("G17", CultureInfo.InvariantCulture); + } + + /// + /// Returns an invariant, roundtrip-safe string representation of this value. + /// + /// + /// an invariant, roundtrip-safe string representation + internal static string ToInvariantString(this int value) + { + // Format R (roundtrip) is not available + return value.ToString("D", CultureInfo.InvariantCulture); + } + + /// + /// Returns an invariant, roundtrip-safe string representation of this value. + /// + /// + /// an invariant, roundtrip-safe string representation + internal static string ToInvariantString(this long value) + { + // Format R (roundtrip) is not available + return value.ToString("D", CultureInfo.InvariantCulture); + } + + /// + /// Returns an invariant, roundtrip-safe string representation of this value. + /// + /// + /// an invariant, roundtrip-safe string representation + internal static string ToInvariantString(this decimal value) + { + // Format R (roundtrip) is not available + return value.ToString(CultureInfo.InvariantCulture); + } + + /// + /// Returns an invariant, roundtrip-safe string representation of this value. + /// + /// "2020-01-10T14:07:04.2921606+01:00" + /// + /// an invariant, roundtrip-safe string representation + internal static string ToInvariantString(this DateTime value) + { + // Format R uses the ugly RFC1123 format + // Format O uses the greatest of all ISO 8601 standard + // The "O" or "o" standard format specifier represents a custom date and time format string using a pattern that preserves time zone information and emits a result string that complies with ISO 8601. + // https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings#the-round-trip-o-o-format-specifier + return value.ToString("o"); + } + + /// + /// Returns an invariant, roundtrip-safe string representation of this value. + /// + /// "16.00:04:15.3840000" + /// + /// an invariant, roundtrip-safe string representation + internal static string ToInvariantString(this TimeSpan value) + { + // Format R (roundtrip) is not available + // The "c" format specifier, unlike the "g" and "G" format specifiers, is not culture-sensitive. + // It produces the string representation of a TimeSpan value that is invariant and that is common to all previous versions of the .NET Framework before the .NET Framework 4. + // https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-timespan-format-strings#the-constant-c-format-specifier + return value.ToString("c", CultureInfo.InvariantCulture); + } + #endregion + } +} diff --git a/Sources/SrkToolkit.Web.AspNetCore2/SrkHtmlExtensions.cs b/Sources/SrkToolkit.Web.AspNetCore2/SrkHtmlExtensions.cs index abe898a..669d3c1 100644 --- a/Sources/SrkToolkit.Web.AspNetCore2/SrkHtmlExtensions.cs +++ b/Sources/SrkToolkit.Web.AspNetCore2/SrkHtmlExtensions.cs @@ -22,24 +22,23 @@ namespace SrkToolkit.Web using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal; using Microsoft.AspNetCore.Routing; - using SrkToolkit.AspNetCore; using SrkToolkit.Web; using SrkToolkit.Web.Models; using SrkToolkit.Web.Open; using System; using System.Collections.Generic; + using System.Globalization; using System.Linq; using System.Text; using System.Linq.Expressions; - using System.Globalization; /// /// HTML extensions. /// public static class SrkHtmlExtensions { - internal const string defaultDateTimeFormatsKey = "SrkDisplayDateFormat"; - internal static readonly string[] defaultDateTimeFormats = new string[] + internal const string DefaultDateTimeFormatsKey = "SrkDisplayDateFormat"; + internal static readonly string[] DefaultDateTimeFormats = new string[] { /* 0 => */ "D", // date /* 1 => */ "D zzz", // date + tz @@ -51,7 +50,7 @@ public static class SrkHtmlExtensions /* 7 => */ "g", // short timespan }; - private static readonly DateTime UnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); + private static readonly DateTime unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); #region SetTimezone, GetTimezone, GetUserDate, GetUtcDate, SetCulture, GetCulture @@ -66,6 +65,7 @@ public static class SrkHtmlExtensions public static IHtmlHelper SetTimezone(this IHtmlHelper html, string timeZoneName) { if (string.IsNullOrEmpty(timeZoneName)) + // ReSharper disable once LocalizableElement throw new ArgumentException("The value cannot be empty", "timeZoneName"); SrkHtmlExtensions.SetTimezone(html, TimeZoneInfo.FindSystemTimeZoneById(timeZoneName)); @@ -107,7 +107,7 @@ public static TimeZoneInfo GetTimezone(this IHtmlHelper html) } /// - /// Gets a based on the user's specified with . + /// Gets a based on the user's specified with . /// /// The HTML. /// The date. @@ -137,7 +137,7 @@ public static DateTime GetUserDate(this IHtmlHelper html, DateTime date, out Dat } /// - /// Gets the UTC based on the user's specified with . + /// Gets the UTC based on the user's specified with . /// /// The HTML. /// The date. @@ -320,7 +320,7 @@ public static string[] GetDateTimeFormats(this IHtmlHelper html) if (html.ViewContext.HttpContext == null) throw new ArgumentNullException("html.ViewContext.HttpContext"); - var values = (string[])html.ViewContext.HttpContext.Items[defaultDateTimeFormatsKey] ?? defaultDateTimeFormats.ToArray(); + var values = (string[])html.ViewContext.HttpContext.Items[DefaultDateTimeFormatsKey] ?? DefaultDateTimeFormats.ToArray(); return values; } @@ -449,7 +449,7 @@ public static HtmlString DisplayDate(this IHtmlHelper html, DateTimeOffset date, } /// - /// Displays a time. + /// Displays a time (part as a date). /// /// The HTML. /// The date value. @@ -483,7 +483,7 @@ public static HtmlString DisplayTime(this IHtmlHelper html, DateTime date, bool } /// - /// Displays a time. + /// Displays a time (part as a date). /// /// The HTML. /// The date value. @@ -515,7 +515,7 @@ public static HtmlString DisplayTime(this IHtmlHelper html, DateTimeOffset date, } /// - /// Displays a time. + /// Displays a time (part as a date). /// /// The HTML. /// The date value. @@ -546,6 +546,160 @@ public static HtmlString DisplayTime(this IHtmlHelper html, TimeSpan date, bool } } + /// + /// Displays a duration. + /// + /// + /// + /// + public static HtmlString DisplayTimeSpan(this IHtmlHelper html, TimeSpan? value) + { + return DisplayTimeSpan(html, value, false, null, true); + } + + /// + /// Displays a duration. + /// + /// + /// + /// + /// + public static HtmlString DisplayTimeSpan(this IHtmlHelper html, TimeSpan? value, bool showMilliseconds) + { + return DisplayTimeSpan(html, value, showMilliseconds, null, true); + } + + /// + /// Displays a duration. + /// + /// + /// + /// + /// + /// + /// + public static HtmlString DisplayTimeSpan(this IHtmlHelper html, TimeSpan? value, bool showMilliseconds, object nullValue, bool asHtml) + { + var b = new StringBuilder(); + string tmp; + + if (value == null && nullValue is TimeSpan) + { + value = (TimeSpan)nullValue; + } + + if (value != null) + { + tmp = value.Value.ToInvariantString(); + + var lang = CultureInfo.CurrentCulture; + var title = value.Value.ToInvariantString() + + " | " + value.Value.TotalDays.ToString("F2", lang) + " days" + + " | " + value.Value.TotalHours.ToString("F2", lang) + " hours" + + " | " + value.Value.TotalSeconds.ToString("F2", lang) + " seconds" + + " | " + value.Value.TotalMilliseconds.ToString("F2", lang) + " milliseconds" + ; + + if (asHtml) + { + b.Append(@""); + } + + if (value.Value.Days != 0) + { + tmp = Math.Abs(value.Value.Days).ToString(); + if (asHtml) + { + b.Append(@""); + b.Append(tmp); + b.Append(@"."); + } + else + { + b.Append(tmp); + b.Append("."); + } + } + + if (value.Value.Days != 0 || value.Value.Hours != 0) + { + tmp = Math.Abs(value.Value.Hours).ToString("00"); + if (asHtml) + { + b.Append(@""); + b.Append(tmp); + b.Append(@":"); + } + else + { + b.Append(tmp); + b.Append(":"); + } + } + + tmp = Math.Abs(value.Value.Minutes).ToString("00"); + if (asHtml) + { + b.Append(@""); + b.Append(tmp); + b.Append(@":"); + } + else + { + b.Append(tmp); + b.Append(":"); + } + + tmp = Math.Abs(value.Value.Seconds).ToString("00"); + if (asHtml) + { + b.Append(@""); + b.Append(tmp); + b.Append(@""); + } + else + { + b.Append(tmp); + } + + if (showMilliseconds) + { + tmp = Math.Abs(value.Value.Milliseconds).ToString("000"); + if (asHtml) + { + b.Append(@"."); + b.Append(tmp); + b.Append(@""); + } + else + { + b.Append("."); + b.Append(tmp); + } + } + + if (asHtml) b.Append(@""); + } + else if (nullValue != null) + { + tmp = nullValue.ToString(); + if (asHtml) + { + b.Append(@""); + b.Append(tmp.ProperHtmlEscape()); + b.Append(@""); + } + else + { + b.Append(tmp); + } + } + + return new HtmlString(b.ToString()); + } + /// /// Returns the date (to UTC) in JavaScript format like 'new Date(123456789000)'. /// @@ -566,7 +720,7 @@ public static HtmlString JsDate(this IHtmlHelper html, DateTime date, DateTimePr * ToString("F0") is important to avoid the exponential notation. */ string value = "new Date(" - + (utc.ToPrecision(precision).Subtract(UnixEpoch).TotalMilliseconds).ToString("F0") + + (utc.ToPrecision(precision).Subtract(unixEpoch).TotalMilliseconds).ToString("F0") + ")"; return new HtmlString(value); } @@ -791,7 +945,7 @@ public static HtmlString DescriptionFor( Expression> expression, object htmlAttributes) { - return DescriptionFor(helper, expression, null, HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes)); + return DescriptionFor(helper, expression, null, IHtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes)); } /// @@ -956,7 +1110,7 @@ public static HtmlString File(this IHtmlHelper html, string name) /// An input element whose type attribute is set to "file". public static HtmlString File(this IHtmlHelper html, string name, object htmlAttributes) { - var attributes = HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes); + var attributes = IHtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes); var builder = new TagBuilder("input"); builder.MergeAttributes(attributes); builder.MergeAttribute("type", "file"); @@ -1080,10 +1234,10 @@ public static HtmlString ValidationSummaryEx(this IHtmlHelper html) public static NavigationLine NavigationLine(this IHtmlHelper html) { if (html.ViewContext == null) - throw new ArgumentNullException("ViewContext is not set", "ctrl"); + throw new ArgumentNullException("html.ViewContext", "ViewContext is not set"); if (html.ViewContext.HttpContext == null) - throw new ArgumentNullException("HttpContext is not set", "ctrl"); + throw new ArgumentNullException("html.ViewContext.HttpContext", "HttpContext is not set"); var line = html.ViewContext.HttpContext.Items[SrkControllerExtensions.NavigationLineKey] as NavigationLine; if (line == null) @@ -1117,7 +1271,7 @@ public static HtmlString CallLink(this IHtmlHelper html, string phoneNumber, obj { var tag = new TagBuilder("a"); tag.Attributes.Add("href", "tel:" + phoneNumber); - var attrCollection = HtmlHelper.AnonymousObjectToHtmlAttributes(attributes); + var attrCollection = IHtmlHelper.AnonymousObjectToHtmlAttributes(attributes); tag.MergeAttributes(attrCollection, true); ////tag.SetInnerText(phoneNumber); // AspNet tag.InnerHtml.Append(phoneNumber); // AspNetCore? diff --git a/Sources/SrkToolkit.Web.AspNetCore2/SrkHttpContextExtensions.cs b/Sources/SrkToolkit.Web.AspNetCore2/SrkHttpContextExtensions.cs index 074c782..8d479c2 100644 --- a/Sources/SrkToolkit.Web.AspNetCore2/SrkHttpContextExtensions.cs +++ b/Sources/SrkToolkit.Web.AspNetCore2/SrkHttpContextExtensions.cs @@ -379,14 +379,14 @@ public static CultureInfo GetUICulture(this HttpContext http) /// The short time format for Html.DisplayShortTime(DateTime). /// The short timespan format for Html.DisplayShortTime(TimeSpan). /// httpContext - public static void SetDateTimeFormats(this HttpContextBase httpContext, string dateFormat = null, string dateTzFormat = null, string timeFormat = null, string timeTzFormat = null, string timespanFormat = null, string dateTimeFormat = null, string shortTimeFormat = null, string shortTimespanFormat = null) + public static void SetDateTimeFormats(this HttpContext httpContext, string dateFormat = null, string dateTzFormat = null, string timeFormat = null, string timeTzFormat = null, string timespanFormat = null, string dateTimeFormat = null, string shortTimeFormat = null, string shortTimespanFormat = null) { if (httpContext == null) throw new ArgumentNullException("httpContext"); var now = DateTime.UtcNow; - var values = (string[])httpContext.Items[System.Web.Mvc.SrkHtmlExtensions.defaultDateTimeFormatsKey] - ?? System.Web.Mvc.SrkHtmlExtensions.defaultDateTimeFormats.ToArray(); + var values = (string[])httpContext.Items[SrkHtmlExtensions.DefaultDateTimeFormatsKey] + ?? SrkHtmlExtensions.DefaultDateTimeFormats.ToArray(); if (!string.IsNullOrEmpty(dateFormat)) { @@ -436,7 +436,7 @@ public static void SetDateTimeFormats(this HttpContextBase httpContext, string d values[7] = shortTimespanFormat; } - httpContext.Items[System.Web.Mvc.SrkHtmlExtensions.defaultDateTimeFormatsKey] = values; + httpContext.Items[SrkHtmlExtensions.DefaultDateTimeFormatsKey] = values; } *//* /// From ecfb20acb85d923335099bc7ea29293a81d6d155 Mon Sep 17 00:00:00 2001 From: SandRock Date: Thu, 23 Mar 2023 11:45:18 +0100 Subject: [PATCH 13/34] SrkToolkit.Web: restore Submit HtmlHelper extension --- .../SrkHtmlExtensions.cs | 322 +++++++++--------- 1 file changed, 161 insertions(+), 161 deletions(-) diff --git a/Sources/SrkToolkit.Web.AspNetCore2/SrkHtmlExtensions.cs b/Sources/SrkToolkit.Web.AspNetCore2/SrkHtmlExtensions.cs index 669d3c1..b103daf 100644 --- a/Sources/SrkToolkit.Web.AspNetCore2/SrkHtmlExtensions.cs +++ b/Sources/SrkToolkit.Web.AspNetCore2/SrkHtmlExtensions.cs @@ -27,7 +27,7 @@ namespace SrkToolkit.Web using SrkToolkit.Web.Open; using System; using System.Collections.Generic; - using System.Globalization; + using System.Globalization; using System.Linq; using System.Text; using System.Linq.Expressions; @@ -545,161 +545,161 @@ public static HtmlString DisplayTime(this IHtmlHelper html, TimeSpan date, bool return new HtmlString(display); } } - - /// - /// Displays a duration. - /// - /// - /// - /// - public static HtmlString DisplayTimeSpan(this IHtmlHelper html, TimeSpan? value) - { - return DisplayTimeSpan(html, value, false, null, true); - } - - /// - /// Displays a duration. - /// - /// - /// - /// - /// - public static HtmlString DisplayTimeSpan(this IHtmlHelper html, TimeSpan? value, bool showMilliseconds) - { - return DisplayTimeSpan(html, value, showMilliseconds, null, true); - } - - /// - /// Displays a duration. - /// - /// - /// - /// - /// - /// - /// - public static HtmlString DisplayTimeSpan(this IHtmlHelper html, TimeSpan? value, bool showMilliseconds, object nullValue, bool asHtml) - { - var b = new StringBuilder(); - string tmp; - - if (value == null && nullValue is TimeSpan) - { - value = (TimeSpan)nullValue; - } - - if (value != null) - { - tmp = value.Value.ToInvariantString(); - - var lang = CultureInfo.CurrentCulture; - var title = value.Value.ToInvariantString() - + " | " + value.Value.TotalDays.ToString("F2", lang) + " days" - + " | " + value.Value.TotalHours.ToString("F2", lang) + " hours" - + " | " + value.Value.TotalSeconds.ToString("F2", lang) + " seconds" - + " | " + value.Value.TotalMilliseconds.ToString("F2", lang) + " milliseconds" - ; - - if (asHtml) - { - b.Append(@""); - } - - if (value.Value.Days != 0) - { - tmp = Math.Abs(value.Value.Days).ToString(); - if (asHtml) - { - b.Append(@""); - b.Append(tmp); - b.Append(@"."); - } - else - { - b.Append(tmp); - b.Append("."); - } - } - - if (value.Value.Days != 0 || value.Value.Hours != 0) - { - tmp = Math.Abs(value.Value.Hours).ToString("00"); - if (asHtml) - { - b.Append(@""); - b.Append(tmp); - b.Append(@":"); - } - else - { - b.Append(tmp); - b.Append(":"); - } - } - - tmp = Math.Abs(value.Value.Minutes).ToString("00"); - if (asHtml) - { - b.Append(@""); - b.Append(tmp); - b.Append(@":"); - } - else - { - b.Append(tmp); - b.Append(":"); - } - - tmp = Math.Abs(value.Value.Seconds).ToString("00"); - if (asHtml) - { - b.Append(@""); - b.Append(tmp); - b.Append(@""); - } - else - { - b.Append(tmp); - } - - if (showMilliseconds) - { - tmp = Math.Abs(value.Value.Milliseconds).ToString("000"); - if (asHtml) - { - b.Append(@"."); - b.Append(tmp); - b.Append(@""); - } - else - { - b.Append("."); - b.Append(tmp); - } - } - - if (asHtml) b.Append(@""); - } - else if (nullValue != null) - { - tmp = nullValue.ToString(); - if (asHtml) - { - b.Append(@""); - b.Append(tmp.ProperHtmlEscape()); - b.Append(@""); - } - else - { - b.Append(tmp); - } - } - - return new HtmlString(b.ToString()); - } - + + /// + /// Displays a duration. + /// + /// + /// + /// + public static HtmlString DisplayTimeSpan(this IHtmlHelper html, TimeSpan? value) + { + return DisplayTimeSpan(html, value, false, null, true); + } + + /// + /// Displays a duration. + /// + /// + /// + /// + /// + public static HtmlString DisplayTimeSpan(this IHtmlHelper html, TimeSpan? value, bool showMilliseconds) + { + return DisplayTimeSpan(html, value, showMilliseconds, null, true); + } + + /// + /// Displays a duration. + /// + /// + /// + /// + /// + /// + /// + public static HtmlString DisplayTimeSpan(this IHtmlHelper html, TimeSpan? value, bool showMilliseconds, object nullValue, bool asHtml) + { + var b = new StringBuilder(); + string tmp; + + if (value == null && nullValue is TimeSpan) + { + value = (TimeSpan)nullValue; + } + + if (value != null) + { + tmp = value.Value.ToInvariantString(); + + var lang = CultureInfo.CurrentCulture; + var title = value.Value.ToInvariantString() + + " | " + value.Value.TotalDays.ToString("F2", lang) + " days" + + " | " + value.Value.TotalHours.ToString("F2", lang) + " hours" + + " | " + value.Value.TotalSeconds.ToString("F2", lang) + " seconds" + + " | " + value.Value.TotalMilliseconds.ToString("F2", lang) + " milliseconds" + ; + + if (asHtml) + { + b.Append(@""); + } + + if (value.Value.Days != 0) + { + tmp = Math.Abs(value.Value.Days).ToString(); + if (asHtml) + { + b.Append(@""); + b.Append(tmp); + b.Append(@"."); + } + else + { + b.Append(tmp); + b.Append("."); + } + } + + if (value.Value.Days != 0 || value.Value.Hours != 0) + { + tmp = Math.Abs(value.Value.Hours).ToString("00"); + if (asHtml) + { + b.Append(@""); + b.Append(tmp); + b.Append(@":"); + } + else + { + b.Append(tmp); + b.Append(":"); + } + } + + tmp = Math.Abs(value.Value.Minutes).ToString("00"); + if (asHtml) + { + b.Append(@""); + b.Append(tmp); + b.Append(@":"); + } + else + { + b.Append(tmp); + b.Append(":"); + } + + tmp = Math.Abs(value.Value.Seconds).ToString("00"); + if (asHtml) + { + b.Append(@""); + b.Append(tmp); + b.Append(@""); + } + else + { + b.Append(tmp); + } + + if (showMilliseconds) + { + tmp = Math.Abs(value.Value.Milliseconds).ToString("000"); + if (asHtml) + { + b.Append(@"."); + b.Append(tmp); + b.Append(@""); + } + else + { + b.Append("."); + b.Append(tmp); + } + } + + if (asHtml) b.Append(@""); + } + else if (nullValue != null) + { + tmp = nullValue.ToString(); + if (asHtml) + { + b.Append(@""); + b.Append(tmp.ProperHtmlEscape()); + b.Append(@""); + } + else + { + b.Append(tmp); + } + } + + return new HtmlString(b.ToString()); + } + /// /// Returns the date (to UTC) in JavaScript format like 'new Date(123456789000)'. /// @@ -1033,7 +1033,7 @@ public static MvcForm BeginFormEx(this IHtmlHelper IHtmlHelper, object htmlAttri #endregion #region Submit -/* + /// /// Returns a submit input element by using the specified HTML helper and the name of the form field. /// @@ -1045,7 +1045,7 @@ public static HtmlString Submit(this IHtmlHelper html, string value) var builder = new TagBuilder("input"); builder.MergeAttribute("type", "submit"); builder.MergeAttribute("value", value); - return new HtmlString(builder.ToString(TagRenderMode.SelfClosing)); + return builder.ToHtmlString(); } /// @@ -1061,7 +1061,7 @@ public static HtmlString Submit(this IHtmlHelper html, string value, string name builder.MergeAttribute("type", "submit"); builder.MergeAttribute("name", name); builder.MergeAttribute("value", value); - return new HtmlString(builder.ToString(TagRenderMode.SelfClosing)); + return builder.ToHtmlString(); } /// @@ -1080,9 +1080,9 @@ public static HtmlString Submit(this IHtmlHelper html, string value, string name builder.MergeAttribute("type", "submit"); builder.MergeAttribute("name", name); builder.MergeAttribute("value", value); - return new HtmlString(builder.ToString(TagRenderMode.SelfClosing)); + return builder.ToHtmlString(); } -*/ + #endregion #region File From 9f63d28d63816ff8ec352e4a6053503e41b04c9d Mon Sep 17 00:00:00 2001 From: SandRock Date: Thu, 23 Mar 2023 11:48:42 +0100 Subject: [PATCH 14/34] nuget: tentative to enhance nuget cross references #25 --- .../SrkToolkit.Domain.AspNetCore2.csproj | 22 +++++++++++++++++-- .../SrkToolkit.Web.AspNetCore2.csproj | 16 +++++++++++++- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/Sources/SrkToolkit.Domain.AspNetCore2/SrkToolkit.Domain.AspNetCore2.csproj b/Sources/SrkToolkit.Domain.AspNetCore2/SrkToolkit.Domain.AspNetCore2.csproj index 4b85f0e..fdfb92d 100644 --- a/Sources/SrkToolkit.Domain.AspNetCore2/SrkToolkit.Domain.AspNetCore2.csproj +++ b/Sources/SrkToolkit.Domain.AspNetCore2/SrkToolkit.Domain.AspNetCore2.csproj @@ -34,12 +34,30 @@ - - + + + + + <_ProjectReferenceWithExplicitPackageVersion Include="@(ProjectReference->'%(FullPath)')" + Condition="'%(ProjectReference.PackageVersion)' != ''" /> + <_ProjectReferenceWithExactPackageVersion Include="@(ProjectReference->'%(FullPath)')" + Condition="'%(ProjectReference.ExactVersion)' == 'true'" /> + <_ProjectReferenceWithReassignedVersion Include="@(_ProjectReferencesWithVersions)" + Condition="'%(Identity)' != '' And '@(_ProjectReferencesWithVersions)' == '@(_ProjectReferenceWithExplicitPackageVersion)'"> + @(_ProjectReferenceWithExplicitPackageVersion->'%(PackageVersion)') + + <_ProjectReferenceWithReassignedVersion Include="@(_ProjectReferencesWithVersions)" + Condition="'%(Identity)' != '' And '@(_ProjectReferencesWithVersions)' == '@(_ProjectReferenceWithExactPackageVersion)'"> + [@(_ProjectReferencesWithVersions->'%(ProjectVersion)')] + + <_ProjectReferencesWithVersions Remove="@(_ProjectReferenceWithReassignedVersion)" /> + <_ProjectReferencesWithVersions Include="@(_ProjectReferenceWithReassignedVersion)" /> + + diff --git a/Sources/SrkToolkit.Web.AspNetCore2/SrkToolkit.Web.AspNetCore2.csproj b/Sources/SrkToolkit.Web.AspNetCore2/SrkToolkit.Web.AspNetCore2.csproj index bc37f93..d0bf0c4 100644 --- a/Sources/SrkToolkit.Web.AspNetCore2/SrkToolkit.Web.AspNetCore2.csproj +++ b/Sources/SrkToolkit.Web.AspNetCore2/SrkToolkit.Web.AspNetCore2.csproj @@ -78,7 +78,7 @@ - + @@ -130,4 +130,18 @@ + + + <_ProjectReferenceWithExplicitPackageVersion Include="@(ProjectReference->'%(FullPath)')" Condition="'%(ProjectReference.PackageVersion)' != ''" /> + <_ProjectReferenceWithExactPackageVersion Include="@(ProjectReference->'%(FullPath)')" Condition="'%(ProjectReference.ExactVersion)' == 'true'" /> + <_ProjectReferenceWithReassignedVersion Include="@(_ProjectReferencesWithVersions)" Condition="'%(Identity)' != '' And '@(_ProjectReferencesWithVersions)' == '@(_ProjectReferenceWithExplicitPackageVersion)'"> + @(_ProjectReferenceWithExplicitPackageVersion->'%(PackageVersion)') + + <_ProjectReferenceWithReassignedVersion Include="@(_ProjectReferencesWithVersions)" Condition="'%(Identity)' != '' And '@(_ProjectReferencesWithVersions)' == '@(_ProjectReferenceWithExactPackageVersion)'"> + [@(_ProjectReferencesWithVersions->'%(ProjectVersion)')] + + <_ProjectReferencesWithVersions Remove="@(_ProjectReferenceWithReassignedVersion)" /> + <_ProjectReferencesWithVersions Include="@(_ProjectReferenceWithReassignedVersion)" /> + + From 121216add5f27cd68e987bf7247c4b39b9389c9e Mon Sep 17 00:00:00 2001 From: SandRock Date: Thu, 23 Mar 2023 14:49:43 +0100 Subject: [PATCH 15/34] SrkToolkit.Web: migrate WebDependencies --- .../SrkToolkit.AspNetCore2.UnitTests.csproj | 2 -- .../WebDependenciesTests.cs | 7 ++-- .../SrkToolkit.Web.AspNetCore2.csproj | 5 +-- .../WebDependencies.cs | 35 ++++++++++++++----- .../WebDependenciesExtensions.cs | 8 +++-- 5 files changed, 37 insertions(+), 20 deletions(-) diff --git a/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkToolkit.AspNetCore2.UnitTests.csproj b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkToolkit.AspNetCore2.UnitTests.csproj index 4241efe..37bdd87 100644 --- a/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkToolkit.AspNetCore2.UnitTests.csproj +++ b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkToolkit.AspNetCore2.UnitTests.csproj @@ -50,8 +50,6 @@ - - diff --git a/Sources/SrkToolkit.AspNetCore2.UnitTests/WebDependenciesTests.cs b/Sources/SrkToolkit.AspNetCore2.UnitTests/WebDependenciesTests.cs index 26b5178..26cd104 100644 --- a/Sources/SrkToolkit.AspNetCore2.UnitTests/WebDependenciesTests.cs +++ b/Sources/SrkToolkit.AspNetCore2.UnitTests/WebDependenciesTests.cs @@ -26,10 +26,13 @@ public class WebDependenciesTests { public class RenderMethod { - [Fact, ExpectedException(typeof(ArgumentNullException))] + [Fact] public void ArgNull() { - new WebDependencies().Render(null); + Assert.Throws(() => + { + new WebDependencies().Render(null); + }); } [Fact] diff --git a/Sources/SrkToolkit.Web.AspNetCore2/SrkToolkit.Web.AspNetCore2.csproj b/Sources/SrkToolkit.Web.AspNetCore2/SrkToolkit.Web.AspNetCore2.csproj index d0bf0c4..836f437 100644 --- a/Sources/SrkToolkit.Web.AspNetCore2/SrkToolkit.Web.AspNetCore2.csproj +++ b/Sources/SrkToolkit.Web.AspNetCore2/SrkToolkit.Web.AspNetCore2.csproj @@ -47,6 +47,7 @@ + @@ -82,12 +83,8 @@ - - - - diff --git a/Sources/SrkToolkit.Web.AspNetCore2/WebDependencies.cs b/Sources/SrkToolkit.Web.AspNetCore2/WebDependencies.cs index 73455a5..5d1b28c 100644 --- a/Sources/SrkToolkit.Web.AspNetCore2/WebDependencies.cs +++ b/Sources/SrkToolkit.Web.AspNetCore2/WebDependencies.cs @@ -17,17 +17,20 @@ namespace SrkToolkit.Web { using Microsoft.AspNetCore.Html; + using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.Rendering; using System; using System.Collections.Generic; using System.Linq; using System.Text; + using System.Text.Encodings.Web; /// /// Manages web dependencies such as scripts and styles. /// public class WebDependencies { + private readonly PathString requestPathBase; protected Dictionary> includes; /// @@ -37,6 +40,17 @@ public WebDependencies() { } + public WebDependencies(PathString requestPathBase) + { + this.requestPathBase = requestPathBase; + } + + protected string ApplicationVirtualPath + { + get { return this.requestPathBase.HasValue ? this.requestPathBase.ToString() : "/"; } + ////set { this.requestPathBase = new PathString(value); } + } + /// /// Renders the specified dependency. /// @@ -50,7 +64,7 @@ public HtmlString Render(WebDependency value) if (value.Files != null) { - var sb = new StringBuilder(); + using var sb = new StringWriter(); for (int i = 0; i < value.Files.Count; i++) { RenderDependency(value.Files[i], sb); @@ -123,8 +137,8 @@ public WebDependencies Include(WebDependency value, WebDependencyPosition positi /// public HtmlString RenderIncludes(WebDependencyPosition position) { - var sb = new StringBuilder(); - sb.AppendLine(""); + using var sb = new StringWriter(); + sb.WriteLine(""); if (this.includes != null && this.includes.Count > 0) { @@ -148,11 +162,11 @@ public HtmlString RenderIncludes(WebDependencyPosition position) } } - sb.AppendLine(""); + sb.WriteLine(""); return new HtmlString(sb.ToString()); } - protected static void RenderDependency(WebDependencyFile value, StringBuilder sb) + protected void RenderDependency(WebDependencyFile value, StringWriter sb) { if (value == null) throw new ArgumentNullException("value"); @@ -164,7 +178,7 @@ protected static void RenderDependency(WebDependencyFile value, StringBuilder sb { if (webPath[0].Equals('~') && webPath[1].Equals('/')) { - var virtualPath = HostingEnvironment.ApplicationVirtualPath ?? "/"; // Root:"/", Subfolder:"/a/b" + var virtualPath = this.ApplicationVirtualPath ?? "/"; // Root:"/", Subfolder:"/a/b" webPath = virtualPath + webPath.Substring(1); // Root:"//Content/Site.css", Subfolder:"/a/b/Content/Site.css" webPath = "/" + webPath.TrimStart('/'); // Root:"/Content/Site.css", Subfolder:"/a/b/Content/Site.css" } @@ -186,7 +200,8 @@ protected static void RenderDependency(WebDependencyFile value, StringBuilder sb tag.MergeAttributes(value.Attributes); } - sb.AppendLine(tag.ToString(TagRenderMode.Normal)); + tag.WriteTo(sb, HtmlEncoder.Default); + sb.WriteLine(); break; case WebDependencyFileType.Css: @@ -214,11 +229,13 @@ protected static void RenderDependency(WebDependencyFile value, StringBuilder sb tag.MergeAttributes(value.Attributes); } - sb.AppendLine(tag.ToString(TagRenderMode.SelfClosing)); + tag.TagRenderMode = TagRenderMode.SelfClosing; + tag.WriteTo(sb, HtmlEncoder.Default); + sb.WriteLine(); break; default: - sb.AppendLine(""); + sb.WriteLine(""); break; } } diff --git a/Sources/SrkToolkit.Web.AspNetCore2/WebDependenciesExtensions.cs b/Sources/SrkToolkit.Web.AspNetCore2/WebDependenciesExtensions.cs index dc7b30d..76bcfac 100644 --- a/Sources/SrkToolkit.Web.AspNetCore2/WebDependenciesExtensions.cs +++ b/Sources/SrkToolkit.Web.AspNetCore2/WebDependenciesExtensions.cs @@ -16,6 +16,8 @@ namespace SrkToolkit.Web { + using Microsoft.AspNetCore.Mvc; + using Microsoft.AspNetCore.Mvc.Razor; using System; using System.Collections.Generic; using System.Linq; @@ -32,7 +34,7 @@ public static class WebDependenciesExtensions /// The view. /// /// view - public static WebDependencies WebDependencies(this WebViewPage view) + public static WebDependencies WebDependencies(this IRazorPage view) { if (view == null) throw new ArgumentNullException("view"); @@ -45,7 +47,7 @@ public static WebDependencies WebDependencies(this WebViewPage view) if (obj == null) { - obj = new WebDependencies(); + obj = new WebDependencies(view.ViewContext.HttpContext.Request.PathBase); view.ViewContext.ViewData["WebDependencies"] = obj; if (view.ViewContext.HttpContext != null) view.ViewContext.HttpContext.Items["WebDependencies"] = obj; @@ -73,7 +75,7 @@ public static WebDependencies WebDependencies(this Controller controller) if (obj == null) { - obj = new WebDependencies(); + obj = new WebDependencies(controller.Request.PathBase); controller.ViewData["WebDependencies"] = obj; if (controller.HttpContext != null) controller.HttpContext.Items["WebDependencies"] = obj; From bc0cc2cdae6d26c9fe447241c1f748f847259926 Mon Sep 17 00:00:00 2001 From: SandRock Date: Mon, 27 Mar 2023 08:52:12 +0200 Subject: [PATCH 16/34] SrkToolkit.Web: compile SrkViewExtensions --- .../SrkToolkit.Web.AspNetCore2/Models/TempMessage.cs | 1 - .../SrkToolkit.Web.AspNetCore2.csproj | 4 +--- .../SrkToolkit.Web.AspNetCore2/SrkViewExtensions.cs | 12 +++++++----- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Sources/SrkToolkit.Web.AspNetCore2/Models/TempMessage.cs b/Sources/SrkToolkit.Web.AspNetCore2/Models/TempMessage.cs index 7d8c806..fd249b5 100644 --- a/Sources/SrkToolkit.Web.AspNetCore2/Models/TempMessage.cs +++ b/Sources/SrkToolkit.Web.AspNetCore2/Models/TempMessage.cs @@ -19,7 +19,6 @@ namespace SrkToolkit.Web.Models using System; using System.Collections.Generic; using System.Linq; - using System.Web; /// /// A message to display at the next loaded web page. diff --git a/Sources/SrkToolkit.Web.AspNetCore2/SrkToolkit.Web.AspNetCore2.csproj b/Sources/SrkToolkit.Web.AspNetCore2/SrkToolkit.Web.AspNetCore2.csproj index 836f437..4466e67 100644 --- a/Sources/SrkToolkit.Web.AspNetCore2/SrkToolkit.Web.AspNetCore2.csproj +++ b/Sources/SrkToolkit.Web.AspNetCore2/SrkToolkit.Web.AspNetCore2.csproj @@ -6,7 +6,7 @@ default SrkToolkit.Web true - 2.0.145-preview1 + 2.0.146-preview1 SandRock Apache-2.0 SrkToolkit.Web.AspNetCore2 is a bunch of extensions and components to use with your ASP MVC Core project. @@ -37,8 +37,6 @@ SrkToolkit.snk - - diff --git a/Sources/SrkToolkit.Web.AspNetCore2/SrkViewExtensions.cs b/Sources/SrkToolkit.Web.AspNetCore2/SrkViewExtensions.cs index 114a1f7..1e8075c 100644 --- a/Sources/SrkToolkit.Web.AspNetCore2/SrkViewExtensions.cs +++ b/Sources/SrkToolkit.Web.AspNetCore2/SrkViewExtensions.cs @@ -16,6 +16,7 @@ namespace SrkToolkit.Web { + using Microsoft.AspNetCore.Mvc.Razor; using SrkToolkit.Web.Models; using System; using System.Collections.Generic; @@ -23,7 +24,7 @@ namespace SrkToolkit.Web using System.Text; /// - /// Extension methods for . + /// Extension methods for . /// public static class SrkViewExtensions { @@ -32,12 +33,13 @@ public static class SrkViewExtensions /// /// /// - public static IList TempMessages(this WebViewPage view) + public static IList TempMessages(this IRazorPage view) { - if (view.TempData == null) - return new List(); + if (view == null) + throw new ArgumentNullException(nameof(view)); - var list = view.TempData[TempMessage.TempDataKey] as IList; + var data = view.ViewContext.TempData; + var list = data[TempMessage.TempDataKey] as IList; return list ?? new List(); } } From bf29d7dd8193e127de52c7c369d40125b1152725 Mon Sep 17 00:00:00 2001 From: SandRock Date: Mon, 27 Mar 2023 09:06:22 +0200 Subject: [PATCH 17/34] nuget: release 2.0.146-preview1 --- Sources/SrkToolkit.Common/SrkToolkit.Common.csproj | 2 +- .../SrkToolkit.Domain.AspNetCore2.csproj | 2 +- Sources/SrkToolkit.Domain/SrkToolkit.Domain.csproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/SrkToolkit.Common/SrkToolkit.Common.csproj b/Sources/SrkToolkit.Common/SrkToolkit.Common.csproj index 9d30a5d..adb5738 100644 --- a/Sources/SrkToolkit.Common/SrkToolkit.Common.csproj +++ b/Sources/SrkToolkit.Common/SrkToolkit.Common.csproj @@ -6,7 +6,7 @@ net40;net7.0;netstandard2.0 9 true - 2.0.145-preview1 + 2.0.146-preview1 SandRock, pyDez Apache-2.0 SrkToolkit.Common contains various extension methods, validators and utility classes. diff --git a/Sources/SrkToolkit.Domain.AspNetCore2/SrkToolkit.Domain.AspNetCore2.csproj b/Sources/SrkToolkit.Domain.AspNetCore2/SrkToolkit.Domain.AspNetCore2.csproj index fdfb92d..1d6acd6 100644 --- a/Sources/SrkToolkit.Domain.AspNetCore2/SrkToolkit.Domain.AspNetCore2.csproj +++ b/Sources/SrkToolkit.Domain.AspNetCore2/SrkToolkit.Domain.AspNetCore2.csproj @@ -6,7 +6,7 @@ enable SrkToolkit.Domain.AspNetCore2 true - 2.0.145-preview1 + 2.0.146-preview1 SandRock Apache-2.0 SrkToolkit.Domain.AspNetCore2 contains extension methods for SrkToolkit.Domain in the context of a ASP MVC Core application. diff --git a/Sources/SrkToolkit.Domain/SrkToolkit.Domain.csproj b/Sources/SrkToolkit.Domain/SrkToolkit.Domain.csproj index 4bec65c..2ff4af6 100644 --- a/Sources/SrkToolkit.Domain/SrkToolkit.Domain.csproj +++ b/Sources/SrkToolkit.Domain/SrkToolkit.Domain.csproj @@ -6,7 +6,7 @@ net46;net7.0;netstandard2.0 9 true - 2.0.145-preview1 + 2.0.146-preview1 SandRock Apache-2.0 SrkToolkit.Domain is used in your domain layer to provider RPC-style request and result classes. From 184cea8099c97a28e46ed9f25e22e5cbe00e860e Mon Sep 17 00:00:00 2001 From: SandRock Date: Mon, 27 Mar 2023 14:40:38 +0200 Subject: [PATCH 18/34] remove old solution files --- Sources/SrkToolkit - Dev.sln | 36 --- Sources/SrkToolkit - VS10.sln | 216 ---------------- Sources/SrkToolkit - VS11.sln | 472 ---------------------------------- 3 files changed, 724 deletions(-) delete mode 100644 Sources/SrkToolkit - Dev.sln delete mode 100644 Sources/SrkToolkit - VS10.sln delete mode 100644 Sources/SrkToolkit - VS11.sln diff --git a/Sources/SrkToolkit - Dev.sln b/Sources/SrkToolkit - Dev.sln deleted file mode 100644 index 1b0a4cd..0000000 --- a/Sources/SrkToolkit - Dev.sln +++ /dev/null @@ -1,36 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SrkToolkit.WildServiceRef.CodeGeneration", "SrkToolkit.WildServiceRef.CodeGeneration\SrkToolkit.WildServiceRef.CodeGeneration.csproj", "{3AF5844E-EB56-4B2F-9679-C6276C0D2869}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SrkToolkit.ServiceDefinition", "SrkToolkit.ServiceDefinition\SrkToolkit.ServiceDefinition.csproj", "{27780307-C96C-4A0B-8A68-756151AF039A}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{563E54B0-9127-47DF-AC4A-F461F8EC490E}" - ProjectSection(SolutionItems) = preProject - Local.testsettings = Local.testsettings - SrkToolkit.vsmdi = SrkToolkit.vsmdi - TraceAndTestImpact.testsettings = TraceAndTestImpact.testsettings - EndProjectSection -EndProject -Global - GlobalSection(TestCaseManagementSettings) = postSolution - CategoryFile = SrkToolkit.vsmdi - EndGlobalSection - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {3AF5844E-EB56-4B2F-9679-C6276C0D2869}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3AF5844E-EB56-4B2F-9679-C6276C0D2869}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3AF5844E-EB56-4B2F-9679-C6276C0D2869}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3AF5844E-EB56-4B2F-9679-C6276C0D2869}.Release|Any CPU.Build.0 = Release|Any CPU - {27780307-C96C-4A0B-8A68-756151AF039A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {27780307-C96C-4A0B-8A68-756151AF039A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {27780307-C96C-4A0B-8A68-756151AF039A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {27780307-C96C-4A0B-8A68-756151AF039A}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/Sources/SrkToolkit - VS10.sln b/Sources/SrkToolkit - VS10.sln deleted file mode 100644 index 5ac9905..0000000 --- a/Sources/SrkToolkit - VS10.sln +++ /dev/null @@ -1,216 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WP7.SrkToolkit.Mvvm", "WP7.SrkToolkit.Mvvm\WP7.SrkToolkit.Mvvm.csproj", "{DE760EB5-95B4-4E56-89FB-48A38DDDC80A}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "10 MVVM Stuff", "10 MVVM Stuff", "{D6B06B88-8371-4360-B47E-8A772B92323A}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF4.SrkToolkit.Mvvm", "WPF4.SrkToolkit.Mvvm\WPF4.SrkToolkit.Mvvm.csproj", "{A842E52E-4001-4BD8-BDCD-C95630D984D4}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SL4.SrkToolkit.Mvvm", "SL4.SrkToolkit.Mvvm\SL4.SrkToolkit.Mvvm.csproj", "{09CD285E-A097-4C38-8598-5A9BE0557030}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "20 XAML", "20 XAML", "{A3324369-1E2D-495C-8E96-109B6F98F003}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF4.SrkToolkit.Xaml", "WPF4.SrkToolkit.Xaml\WPF4.SrkToolkit.Xaml.csproj", "{09A84445-2AA3-4D99-89F7-007CA3EF91A3}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WP71.SrkToolkit.Mvvm", "WP71.SrkToolkit.Mvvm\WP71.SrkToolkit.Mvvm.csproj", "{011FCD78-30C5-42BC-9499-AA4B4CDD7897}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "00 ApplicationServices", "00 ApplicationServices", "{B70211DF-4DB4-4D29-842C-1CE527BD1EFC}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET4.SrkToolkit.Services", "NET4.SrkToolkit.Services\NET4.SrkToolkit.Services.csproj", "{CFDFCEA2-BAFB-455E-BEF4-40343DE968CF}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET4.SrkToolkit.Services.Tests", "NET4.SrkToolkit.Services.Tests\NET4.SrkToolkit.Services.Tests.csproj", "{7E6D5FC5-4ED0-433C-A92C-D4A0C0146CCB}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{563E54B0-9127-47DF-AC4A-F461F8EC490E}" - ProjectSection(SolutionItems) = preProject - Local.testsettings = Local.testsettings - SrkToolkit.vsmdi = SrkToolkit.vsmdi - TraceAndTestImpact.testsettings = TraceAndTestImpact.testsettings - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WP7.SrkToolkit.Services", "WP7.SrkToolkit.Services\WP7.SrkToolkit.Services.csproj", "{C0B51E2B-E18C-4F3E-B7E6-40F322029EDA}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WP71.SrkToolkit.Services", "WP71.SrkToolkit.Services\WP71.SrkToolkit.Services.csproj", "{53D43F26-87EC-4217-A53D-33C1BFC9E778}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SL4.SrkToolkit.Services", "SL4.SrkToolkit.Services\SL4.SrkToolkit.Services.csproj", "{0E5AD562-FA5E-443F-A773-7C992E54209E}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET4.SrkToolkit.Mvvm.Tests", "NET4.SrkToolkit.Mvvm.Tests\NET4.SrkToolkit.Mvvm.Tests.csproj", "{9C42B357-7E5D-4192-850D-190EAEC0416A}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SL4.SrkToolkit.Xaml", "SL4.SrkToolkit.Xaml\SL4.SrkToolkit.Xaml.csproj", "{F156F957-A86C-43BD-8957-29F464BFBED0}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WP7.SrkToolkit.Xaml", "WP7.SrkToolkit.Xaml\WP7.SrkToolkit.Xaml.csproj", "{42516A13-035C-48F7-A8DB-35681BF7117C}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WP71.SrkToolkit.Xaml", "WP71.SrkToolkit.Xaml\WP71.SrkToolkit.Xaml.csproj", "{D3B7AB5F-493E-495E-8853-3E4454AFA794}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SL5.SrkToolkit.Xaml", "SL5.SrkToolkit.Xaml\SL5.SrkToolkit.Xaml.csproj", "{913047F4-1361-428D-997E-E8A6707B5ECA}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "30 Domain", "30 Domain", "{8EDF3F31-4778-47E0-BFD2-3C23E227A2F6}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET4.SrkToolkit.Domain", "NET4.SrkToolkit.Domain\NET4.SrkToolkit.Domain.csproj", "{893A7FD4-62E6-4F7A-8FF9-EA502ADA88FA}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "40 Common", "40 Common", "{955C529B-A44B-4176-B49A-C0430D78A08C}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET4.SrkToolkit.Common", "NET4.SrkToolkit.Common\NET4.SrkToolkit.Common.csproj", "{19495A45-67A8-460D-806C-CF158B96BBE9}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "50 Web", "50 Web", "{D1C680C8-2F64-48D3-98F6-FC6F41B37939}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET4.SrkToolkit.Web", "NET4.SrkToolkit.Web\NET4.SrkToolkit.Web.csproj", "{1D73A9E4-7F61-4288-BDE1-E13CC63872C0}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET4.SrkToolkit.Common.Unsafe", "NET4.SrkToolkit.Common.Unsafe\NET4.SrkToolkit.Common.Unsafe.csproj", "{19727F77-249A-4AC9-859C-8441E5BD41C4}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET4.SrkToolkit.Common.Tests", "NET4.SrkToolkit.Common.Tests\NET4.SrkToolkit.Common.Tests.csproj", "{51E43E76-A342-42D3-A8AD-ABC45CEBD9C5}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET4.SrkToolkit.Web.Mvc3", "NET4.SrkToolkit.Web.Mvc3\NET4.SrkToolkit.Web.Mvc3.csproj", "{C7CB8AC5-E948-4738-B440-ECAE8656667F}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET4.SrkToolkit.Web.Tests", "NET4.SrkToolkit.Web.Tests\NET4.SrkToolkit.Web.Tests.csproj", "{E0D59BBD-CF69-40E9-8023-C113DCEBC0AF}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET4.SrkToolkit.Domain.Tests", "NET4.SrkToolkit.Domain.Tests\NET4.SrkToolkit.Domain.Tests.csproj", "{80D861DB-FC7B-4DF7-8D87-750EEFC82B46}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET4.SrkToolkit.WebForms", "NET4.SrkToolkit.WebForms\NET4.SrkToolkit.WebForms.csproj", "{42AB07F9-CEB2-4A5B-A8FC-B7A85AD4DFD3}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "99 Samples", "99 Samples", "{F9C87A08-EAF0-4DB2-B3DB-4C516BA5348A}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SrkToolkit.MvcSamples", "SrkToolkit.MvcSamples\SrkToolkit.MvcSamples.csproj", "{C46DD3B8-4E28-4BC8-9302-7BA20C056BFF}" -EndProject -Global - GlobalSection(TestCaseManagementSettings) = postSolution - CategoryFile = SrkToolkit.vsmdi - EndGlobalSection - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {DE760EB5-95B4-4E56-89FB-48A38DDDC80A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DE760EB5-95B4-4E56-89FB-48A38DDDC80A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DE760EB5-95B4-4E56-89FB-48A38DDDC80A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DE760EB5-95B4-4E56-89FB-48A38DDDC80A}.Release|Any CPU.Build.0 = Release|Any CPU - {A842E52E-4001-4BD8-BDCD-C95630D984D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A842E52E-4001-4BD8-BDCD-C95630D984D4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A842E52E-4001-4BD8-BDCD-C95630D984D4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A842E52E-4001-4BD8-BDCD-C95630D984D4}.Release|Any CPU.Build.0 = Release|Any CPU - {09CD285E-A097-4C38-8598-5A9BE0557030}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {09CD285E-A097-4C38-8598-5A9BE0557030}.Debug|Any CPU.Build.0 = Debug|Any CPU - {09CD285E-A097-4C38-8598-5A9BE0557030}.Release|Any CPU.ActiveCfg = Release|Any CPU - {09CD285E-A097-4C38-8598-5A9BE0557030}.Release|Any CPU.Build.0 = Release|Any CPU - {09A84445-2AA3-4D99-89F7-007CA3EF91A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {09A84445-2AA3-4D99-89F7-007CA3EF91A3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {09A84445-2AA3-4D99-89F7-007CA3EF91A3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {09A84445-2AA3-4D99-89F7-007CA3EF91A3}.Release|Any CPU.Build.0 = Release|Any CPU - {011FCD78-30C5-42BC-9499-AA4B4CDD7897}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {011FCD78-30C5-42BC-9499-AA4B4CDD7897}.Debug|Any CPU.Build.0 = Debug|Any CPU - {011FCD78-30C5-42BC-9499-AA4B4CDD7897}.Release|Any CPU.ActiveCfg = Release|Any CPU - {011FCD78-30C5-42BC-9499-AA4B4CDD7897}.Release|Any CPU.Build.0 = Release|Any CPU - {CFDFCEA2-BAFB-455E-BEF4-40343DE968CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CFDFCEA2-BAFB-455E-BEF4-40343DE968CF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CFDFCEA2-BAFB-455E-BEF4-40343DE968CF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CFDFCEA2-BAFB-455E-BEF4-40343DE968CF}.Release|Any CPU.Build.0 = Release|Any CPU - {7E6D5FC5-4ED0-433C-A92C-D4A0C0146CCB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7E6D5FC5-4ED0-433C-A92C-D4A0C0146CCB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7E6D5FC5-4ED0-433C-A92C-D4A0C0146CCB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7E6D5FC5-4ED0-433C-A92C-D4A0C0146CCB}.Release|Any CPU.Build.0 = Release|Any CPU - {C0B51E2B-E18C-4F3E-B7E6-40F322029EDA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C0B51E2B-E18C-4F3E-B7E6-40F322029EDA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C0B51E2B-E18C-4F3E-B7E6-40F322029EDA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C0B51E2B-E18C-4F3E-B7E6-40F322029EDA}.Release|Any CPU.Build.0 = Release|Any CPU - {53D43F26-87EC-4217-A53D-33C1BFC9E778}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {53D43F26-87EC-4217-A53D-33C1BFC9E778}.Debug|Any CPU.Build.0 = Debug|Any CPU - {53D43F26-87EC-4217-A53D-33C1BFC9E778}.Release|Any CPU.ActiveCfg = Release|Any CPU - {53D43F26-87EC-4217-A53D-33C1BFC9E778}.Release|Any CPU.Build.0 = Release|Any CPU - {0E5AD562-FA5E-443F-A773-7C992E54209E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0E5AD562-FA5E-443F-A773-7C992E54209E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0E5AD562-FA5E-443F-A773-7C992E54209E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0E5AD562-FA5E-443F-A773-7C992E54209E}.Release|Any CPU.Build.0 = Release|Any CPU - {9C42B357-7E5D-4192-850D-190EAEC0416A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9C42B357-7E5D-4192-850D-190EAEC0416A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9C42B357-7E5D-4192-850D-190EAEC0416A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9C42B357-7E5D-4192-850D-190EAEC0416A}.Release|Any CPU.Build.0 = Release|Any CPU - {F156F957-A86C-43BD-8957-29F464BFBED0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F156F957-A86C-43BD-8957-29F464BFBED0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F156F957-A86C-43BD-8957-29F464BFBED0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F156F957-A86C-43BD-8957-29F464BFBED0}.Release|Any CPU.Build.0 = Release|Any CPU - {42516A13-035C-48F7-A8DB-35681BF7117C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {42516A13-035C-48F7-A8DB-35681BF7117C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {42516A13-035C-48F7-A8DB-35681BF7117C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {42516A13-035C-48F7-A8DB-35681BF7117C}.Release|Any CPU.Build.0 = Release|Any CPU - {D3B7AB5F-493E-495E-8853-3E4454AFA794}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D3B7AB5F-493E-495E-8853-3E4454AFA794}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D3B7AB5F-493E-495E-8853-3E4454AFA794}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D3B7AB5F-493E-495E-8853-3E4454AFA794}.Release|Any CPU.Build.0 = Release|Any CPU - {913047F4-1361-428D-997E-E8A6707B5ECA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {913047F4-1361-428D-997E-E8A6707B5ECA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {913047F4-1361-428D-997E-E8A6707B5ECA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {913047F4-1361-428D-997E-E8A6707B5ECA}.Release|Any CPU.Build.0 = Release|Any CPU - {893A7FD4-62E6-4F7A-8FF9-EA502ADA88FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {893A7FD4-62E6-4F7A-8FF9-EA502ADA88FA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {893A7FD4-62E6-4F7A-8FF9-EA502ADA88FA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {893A7FD4-62E6-4F7A-8FF9-EA502ADA88FA}.Release|Any CPU.Build.0 = Release|Any CPU - {19495A45-67A8-460D-806C-CF158B96BBE9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {19495A45-67A8-460D-806C-CF158B96BBE9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {19495A45-67A8-460D-806C-CF158B96BBE9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {19495A45-67A8-460D-806C-CF158B96BBE9}.Release|Any CPU.Build.0 = Release|Any CPU - {1D73A9E4-7F61-4288-BDE1-E13CC63872C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1D73A9E4-7F61-4288-BDE1-E13CC63872C0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1D73A9E4-7F61-4288-BDE1-E13CC63872C0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1D73A9E4-7F61-4288-BDE1-E13CC63872C0}.Release|Any CPU.Build.0 = Release|Any CPU - {19727F77-249A-4AC9-859C-8441E5BD41C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {19727F77-249A-4AC9-859C-8441E5BD41C4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {19727F77-249A-4AC9-859C-8441E5BD41C4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {19727F77-249A-4AC9-859C-8441E5BD41C4}.Release|Any CPU.Build.0 = Release|Any CPU - {51E43E76-A342-42D3-A8AD-ABC45CEBD9C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {51E43E76-A342-42D3-A8AD-ABC45CEBD9C5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {51E43E76-A342-42D3-A8AD-ABC45CEBD9C5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {51E43E76-A342-42D3-A8AD-ABC45CEBD9C5}.Release|Any CPU.Build.0 = Release|Any CPU - {C7CB8AC5-E948-4738-B440-ECAE8656667F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C7CB8AC5-E948-4738-B440-ECAE8656667F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C7CB8AC5-E948-4738-B440-ECAE8656667F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C7CB8AC5-E948-4738-B440-ECAE8656667F}.Release|Any CPU.Build.0 = Release|Any CPU - {E0D59BBD-CF69-40E9-8023-C113DCEBC0AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E0D59BBD-CF69-40E9-8023-C113DCEBC0AF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E0D59BBD-CF69-40E9-8023-C113DCEBC0AF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E0D59BBD-CF69-40E9-8023-C113DCEBC0AF}.Release|Any CPU.Build.0 = Release|Any CPU - {80D861DB-FC7B-4DF7-8D87-750EEFC82B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {80D861DB-FC7B-4DF7-8D87-750EEFC82B46}.Debug|Any CPU.Build.0 = Debug|Any CPU - {80D861DB-FC7B-4DF7-8D87-750EEFC82B46}.Release|Any CPU.ActiveCfg = Release|Any CPU - {80D861DB-FC7B-4DF7-8D87-750EEFC82B46}.Release|Any CPU.Build.0 = Release|Any CPU - {42AB07F9-CEB2-4A5B-A8FC-B7A85AD4DFD3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {42AB07F9-CEB2-4A5B-A8FC-B7A85AD4DFD3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {42AB07F9-CEB2-4A5B-A8FC-B7A85AD4DFD3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {42AB07F9-CEB2-4A5B-A8FC-B7A85AD4DFD3}.Release|Any CPU.Build.0 = Release|Any CPU - {C46DD3B8-4E28-4BC8-9302-7BA20C056BFF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C46DD3B8-4E28-4BC8-9302-7BA20C056BFF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C46DD3B8-4E28-4BC8-9302-7BA20C056BFF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C46DD3B8-4E28-4BC8-9302-7BA20C056BFF}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {DE760EB5-95B4-4E56-89FB-48A38DDDC80A} = {D6B06B88-8371-4360-B47E-8A772B92323A} - {A842E52E-4001-4BD8-BDCD-C95630D984D4} = {D6B06B88-8371-4360-B47E-8A772B92323A} - {09CD285E-A097-4C38-8598-5A9BE0557030} = {D6B06B88-8371-4360-B47E-8A772B92323A} - {011FCD78-30C5-42BC-9499-AA4B4CDD7897} = {D6B06B88-8371-4360-B47E-8A772B92323A} - {9C42B357-7E5D-4192-850D-190EAEC0416A} = {D6B06B88-8371-4360-B47E-8A772B92323A} - {09A84445-2AA3-4D99-89F7-007CA3EF91A3} = {A3324369-1E2D-495C-8E96-109B6F98F003} - {F156F957-A86C-43BD-8957-29F464BFBED0} = {A3324369-1E2D-495C-8E96-109B6F98F003} - {42516A13-035C-48F7-A8DB-35681BF7117C} = {A3324369-1E2D-495C-8E96-109B6F98F003} - {D3B7AB5F-493E-495E-8853-3E4454AFA794} = {A3324369-1E2D-495C-8E96-109B6F98F003} - {913047F4-1361-428D-997E-E8A6707B5ECA} = {A3324369-1E2D-495C-8E96-109B6F98F003} - {CFDFCEA2-BAFB-455E-BEF4-40343DE968CF} = {B70211DF-4DB4-4D29-842C-1CE527BD1EFC} - {7E6D5FC5-4ED0-433C-A92C-D4A0C0146CCB} = {B70211DF-4DB4-4D29-842C-1CE527BD1EFC} - {563E54B0-9127-47DF-AC4A-F461F8EC490E} = {B70211DF-4DB4-4D29-842C-1CE527BD1EFC} - {C0B51E2B-E18C-4F3E-B7E6-40F322029EDA} = {B70211DF-4DB4-4D29-842C-1CE527BD1EFC} - {53D43F26-87EC-4217-A53D-33C1BFC9E778} = {B70211DF-4DB4-4D29-842C-1CE527BD1EFC} - {0E5AD562-FA5E-443F-A773-7C992E54209E} = {B70211DF-4DB4-4D29-842C-1CE527BD1EFC} - {893A7FD4-62E6-4F7A-8FF9-EA502ADA88FA} = {8EDF3F31-4778-47E0-BFD2-3C23E227A2F6} - {80D861DB-FC7B-4DF7-8D87-750EEFC82B46} = {8EDF3F31-4778-47E0-BFD2-3C23E227A2F6} - {19495A45-67A8-460D-806C-CF158B96BBE9} = {955C529B-A44B-4176-B49A-C0430D78A08C} - {19727F77-249A-4AC9-859C-8441E5BD41C4} = {955C529B-A44B-4176-B49A-C0430D78A08C} - {51E43E76-A342-42D3-A8AD-ABC45CEBD9C5} = {955C529B-A44B-4176-B49A-C0430D78A08C} - {1D73A9E4-7F61-4288-BDE1-E13CC63872C0} = {D1C680C8-2F64-48D3-98F6-FC6F41B37939} - {C7CB8AC5-E948-4738-B440-ECAE8656667F} = {D1C680C8-2F64-48D3-98F6-FC6F41B37939} - {E0D59BBD-CF69-40E9-8023-C113DCEBC0AF} = {D1C680C8-2F64-48D3-98F6-FC6F41B37939} - {42AB07F9-CEB2-4A5B-A8FC-B7A85AD4DFD3} = {D1C680C8-2F64-48D3-98F6-FC6F41B37939} - {C46DD3B8-4E28-4BC8-9302-7BA20C056BFF} = {F9C87A08-EAF0-4DB2-B3DB-4C516BA5348A} - EndGlobalSection -EndGlobal diff --git a/Sources/SrkToolkit - VS11.sln b/Sources/SrkToolkit - VS11.sln deleted file mode 100644 index 3b2bd0b..0000000 --- a/Sources/SrkToolkit - VS11.sln +++ /dev/null @@ -1,472 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.40629.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "10 MVVM Stuff", "10 MVVM Stuff", "{D6B06B88-8371-4360-B47E-8A772B92323A}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "20 XAML", "20 XAML", "{A3324369-1E2D-495C-8E96-109B6F98F003}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "00 ApplicationServices", "00 ApplicationServices", "{B70211DF-4DB4-4D29-842C-1CE527BD1EFC}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{563E54B0-9127-47DF-AC4A-F461F8EC490E}" - ProjectSection(SolutionItems) = preProject - Local.testsettings = Local.testsettings - SrkToolkit.vsmdi = SrkToolkit.vsmdi - TraceAndTestImpact.testsettings = TraceAndTestImpact.testsettings - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "30 Domain", "30 Domain", "{559DC157-DDC9-44BA-B25D-0A18E286D1CC}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "40 Common", "40 Common", "{C3406DF1-E92C-4100-BEF9-B49F616E77C5}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "50 Web", "50 Web", "{B9ACA570-A4AC-4AC9-95E2-A95BCEDBD866}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF4.SrkToolkit.Mvvm", "WPF4.SrkToolkit.Mvvm\WPF4.SrkToolkit.Mvvm.csproj", "{A842E52E-4001-4BD8-BDCD-C95630D984D4}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SL4.SrkToolkit.Mvvm", "SL4.SrkToolkit.Mvvm\SL4.SrkToolkit.Mvvm.csproj", "{09CD285E-A097-4C38-8598-5A9BE0557030}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF4.SrkToolkit.Xaml", "WPF4.SrkToolkit.Xaml\WPF4.SrkToolkit.Xaml.csproj", "{09A84445-2AA3-4D99-89F7-007CA3EF91A3}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET4.SrkToolkit.Services", "NET4.SrkToolkit.Services\NET4.SrkToolkit.Services.csproj", "{CFDFCEA2-BAFB-455E-BEF4-40343DE968CF}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET4.SrkToolkit.Services.Tests", "NET4.SrkToolkit.Services.Tests\NET4.SrkToolkit.Services.Tests.csproj", "{7E6D5FC5-4ED0-433C-A92C-D4A0C0146CCB}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SL4.SrkToolkit.Services", "SL4.SrkToolkit.Services\SL4.SrkToolkit.Services.csproj", "{0E5AD562-FA5E-443F-A773-7C992E54209E}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET4.SrkToolkit.Mvvm.Tests", "NET4.SrkToolkit.Mvvm.Tests\NET4.SrkToolkit.Mvvm.Tests.csproj", "{9C42B357-7E5D-4192-850D-190EAEC0416A}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF45.SrkToolkit.Xaml", "WPF45.SrkToolkit.Xaml\WPF45.SrkToolkit.Xaml.csproj", "{A6D741FB-B974-491A-A2CE-DE7F491FD66D}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF45.SrkToolkit.Mvvm", "WPF45.SrkToolkit.Mvvm\WPF45.SrkToolkit.Mvvm.csproj", "{175B67BE-9042-45EE-A8DF-D96FE8B75561}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SL4.SrkToolkit.Xaml", "SL4.SrkToolkit.Xaml\SL4.SrkToolkit.Xaml.csproj", "{F156F957-A86C-43BD-8957-29F464BFBED0}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RT.SrkToolkit.Services", "RT.SrkToolkit.Services\RT.SrkToolkit.Services.csproj", "{D009CCA7-212D-43AC-BB0D-803F902526CA}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET4.SrkToolkit.Domain", "NET4.SrkToolkit.Domain\NET4.SrkToolkit.Domain.csproj", "{893A7FD4-62E6-4F7A-8FF9-EA502ADA88FA}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET4.SrkToolkit.Common", "NET4.SrkToolkit.Common\NET4.SrkToolkit.Common.csproj", "{19495A45-67A8-460D-806C-CF158B96BBE9}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET4.SrkToolkit.Common.Unsafe", "NET4.SrkToolkit.Common.Unsafe\NET4.SrkToolkit.Common.Unsafe.csproj", "{19727F77-249A-4AC9-859C-8441E5BD41C4}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET4.SrkToolkit.Common.Tests", "NET4.SrkToolkit.Common.Tests\NET4.SrkToolkit.Common.Tests.csproj", "{51E43E76-A342-42D3-A8AD-ABC45CEBD9C5}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET4.SrkToolkit.Domain.Tests", "NET4.SrkToolkit.Domain.Tests\NET4.SrkToolkit.Domain.Tests.csproj", "{80D861DB-FC7B-4DF7-8D87-750EEFC82B46}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET4.SrkToolkit.Web", "NET4.SrkToolkit.Web\NET4.SrkToolkit.Web.csproj", "{1D73A9E4-7F61-4288-BDE1-E13CC63872C0}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET4.SrkToolkit.Web.Mvc3", "NET4.SrkToolkit.Web.Mvc3\NET4.SrkToolkit.Web.Mvc3.csproj", "{C7CB8AC5-E948-4738-B440-ECAE8656667F}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET4.SrkToolkit.Web.Tests", "NET4.SrkToolkit.Web.Tests\NET4.SrkToolkit.Web.Tests.csproj", "{E0D59BBD-CF69-40E9-8023-C113DCEBC0AF}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET4.SrkToolkit.WebForms", "NET4.SrkToolkit.WebForms\NET4.SrkToolkit.WebForms.csproj", "{42AB07F9-CEB2-4A5B-A8FC-B7A85AD4DFD3}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET4.SrkToolkit.Domain.AspMvc4", "NET4.SrkToolkit.Domain.AspMvc4\NET4.SrkToolkit.Domain.AspMvc4.csproj", "{C59BD98A-2C25-4F1D-A860-751AE1F800EB}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET45.SrkToolkit.Common", "NET45.SrkToolkit.Common\NET45.SrkToolkit.Common.csproj", "{AD101432-1950-4F01-825A-7D108B30DA35}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET45.SrkToolkit.Domain", "NET45.SrkToolkit.Domain\NET45.SrkToolkit.Domain.csproj", "{50F8A9BC-CA87-48D0-BA18-32DF5F50A97A}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET45.SrkToolkit.Domain.AspMvc4", "NET45.SrkToolkit.Domain.AspMvc4\NET45.SrkToolkit.Domain.AspMvc4.csproj", "{0765606F-88B9-4682-80D3-64E612ADCB81}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET45.SrkToolkit.Web.Mvc4", "NET45.SrkToolkit.Web.Mvc4\NET45.SrkToolkit.Web.Mvc4.csproj", "{F60EC4EC-B969-4E8E-8E15-374BFACF99CF}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET45.SrkToolkit.Web.Mvc5", "NET45.SrkToolkit.Web.Mvc5\NET45.SrkToolkit.Web.Mvc5.csproj", "{55341205-ACB8-4E7D-8E39-0629AA8C2C32}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET45.SrkToolkit.Domain.AspMvc5", "NET45.SrkToolkit.Domain.AspMvc5\NET45.SrkToolkit.Domain.AspMvc5.csproj", "{F354D8B6-F293-45ED-AF9B-B746E1232C17}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WP81.SrkToolkit.Services", "WP81.SrkToolkit.Services\WP81.SrkToolkit.Services.csproj", "{C54EFA11-B338-4E08-8718-595AEE63BA04}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WP80.SrkToolkit.Services", "WP80.SrkToolkit.Services\WP80.SrkToolkit.Services.csproj", "{81AFF745-6E02-4AFE-A871-3B86AEED1E1B}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET45.SrkToolkit.Common.Tests", "NET45.SrkToolkit.Common.Tests\NET45.SrkToolkit.Common.Tests.csproj", "{50AF7833-C345-4F6C-9FB1-36EB176D68E1}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UWP461.SrkToolkit.Mvvm", "UWP461.SrkToolkit.Mvvm\UWP461.SrkToolkit.Mvvm.csproj", "{1B365EA8-743C-4105-B86D-FF412DAD0DAF}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UWP461.SrkToolkit.Xaml", "UWP461.SrkToolkit.Xaml\UWP461.SrkToolkit.Xaml.csproj", "{24E9D52C-6679-47E1-A2C6-6FEB34C79712}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|ARM = Debug|ARM - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|ARM = Release|ARM - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {A842E52E-4001-4BD8-BDCD-C95630D984D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A842E52E-4001-4BD8-BDCD-C95630D984D4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A842E52E-4001-4BD8-BDCD-C95630D984D4}.Debug|ARM.ActiveCfg = Debug|Any CPU - {A842E52E-4001-4BD8-BDCD-C95630D984D4}.Debug|x64.ActiveCfg = Debug|Any CPU - {A842E52E-4001-4BD8-BDCD-C95630D984D4}.Debug|x86.ActiveCfg = Debug|Any CPU - {A842E52E-4001-4BD8-BDCD-C95630D984D4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A842E52E-4001-4BD8-BDCD-C95630D984D4}.Release|Any CPU.Build.0 = Release|Any CPU - {A842E52E-4001-4BD8-BDCD-C95630D984D4}.Release|ARM.ActiveCfg = Release|Any CPU - {A842E52E-4001-4BD8-BDCD-C95630D984D4}.Release|x64.ActiveCfg = Release|Any CPU - {A842E52E-4001-4BD8-BDCD-C95630D984D4}.Release|x86.ActiveCfg = Release|Any CPU - {09CD285E-A097-4C38-8598-5A9BE0557030}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {09CD285E-A097-4C38-8598-5A9BE0557030}.Debug|Any CPU.Build.0 = Debug|Any CPU - {09CD285E-A097-4C38-8598-5A9BE0557030}.Debug|ARM.ActiveCfg = Debug|Any CPU - {09CD285E-A097-4C38-8598-5A9BE0557030}.Debug|x64.ActiveCfg = Debug|Any CPU - {09CD285E-A097-4C38-8598-5A9BE0557030}.Debug|x86.ActiveCfg = Debug|Any CPU - {09CD285E-A097-4C38-8598-5A9BE0557030}.Release|Any CPU.ActiveCfg = Release|Any CPU - {09CD285E-A097-4C38-8598-5A9BE0557030}.Release|Any CPU.Build.0 = Release|Any CPU - {09CD285E-A097-4C38-8598-5A9BE0557030}.Release|ARM.ActiveCfg = Release|Any CPU - {09CD285E-A097-4C38-8598-5A9BE0557030}.Release|x64.ActiveCfg = Release|Any CPU - {09CD285E-A097-4C38-8598-5A9BE0557030}.Release|x86.ActiveCfg = Release|Any CPU - {09A84445-2AA3-4D99-89F7-007CA3EF91A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {09A84445-2AA3-4D99-89F7-007CA3EF91A3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {09A84445-2AA3-4D99-89F7-007CA3EF91A3}.Debug|ARM.ActiveCfg = Debug|Any CPU - {09A84445-2AA3-4D99-89F7-007CA3EF91A3}.Debug|x64.ActiveCfg = Debug|Any CPU - {09A84445-2AA3-4D99-89F7-007CA3EF91A3}.Debug|x86.ActiveCfg = Debug|Any CPU - {09A84445-2AA3-4D99-89F7-007CA3EF91A3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {09A84445-2AA3-4D99-89F7-007CA3EF91A3}.Release|Any CPU.Build.0 = Release|Any CPU - {09A84445-2AA3-4D99-89F7-007CA3EF91A3}.Release|ARM.ActiveCfg = Release|Any CPU - {09A84445-2AA3-4D99-89F7-007CA3EF91A3}.Release|x64.ActiveCfg = Release|Any CPU - {09A84445-2AA3-4D99-89F7-007CA3EF91A3}.Release|x86.ActiveCfg = Release|Any CPU - {CFDFCEA2-BAFB-455E-BEF4-40343DE968CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CFDFCEA2-BAFB-455E-BEF4-40343DE968CF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CFDFCEA2-BAFB-455E-BEF4-40343DE968CF}.Debug|ARM.ActiveCfg = Debug|Any CPU - {CFDFCEA2-BAFB-455E-BEF4-40343DE968CF}.Debug|x64.ActiveCfg = Debug|Any CPU - {CFDFCEA2-BAFB-455E-BEF4-40343DE968CF}.Debug|x86.ActiveCfg = Debug|Any CPU - {CFDFCEA2-BAFB-455E-BEF4-40343DE968CF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CFDFCEA2-BAFB-455E-BEF4-40343DE968CF}.Release|Any CPU.Build.0 = Release|Any CPU - {CFDFCEA2-BAFB-455E-BEF4-40343DE968CF}.Release|ARM.ActiveCfg = Release|Any CPU - {CFDFCEA2-BAFB-455E-BEF4-40343DE968CF}.Release|x64.ActiveCfg = Release|Any CPU - {CFDFCEA2-BAFB-455E-BEF4-40343DE968CF}.Release|x86.ActiveCfg = Release|Any CPU - {7E6D5FC5-4ED0-433C-A92C-D4A0C0146CCB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7E6D5FC5-4ED0-433C-A92C-D4A0C0146CCB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7E6D5FC5-4ED0-433C-A92C-D4A0C0146CCB}.Debug|ARM.ActiveCfg = Debug|Any CPU - {7E6D5FC5-4ED0-433C-A92C-D4A0C0146CCB}.Debug|x64.ActiveCfg = Debug|Any CPU - {7E6D5FC5-4ED0-433C-A92C-D4A0C0146CCB}.Debug|x86.ActiveCfg = Debug|Any CPU - {7E6D5FC5-4ED0-433C-A92C-D4A0C0146CCB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7E6D5FC5-4ED0-433C-A92C-D4A0C0146CCB}.Release|Any CPU.Build.0 = Release|Any CPU - {7E6D5FC5-4ED0-433C-A92C-D4A0C0146CCB}.Release|ARM.ActiveCfg = Release|Any CPU - {7E6D5FC5-4ED0-433C-A92C-D4A0C0146CCB}.Release|x64.ActiveCfg = Release|Any CPU - {7E6D5FC5-4ED0-433C-A92C-D4A0C0146CCB}.Release|x86.ActiveCfg = Release|Any CPU - {0E5AD562-FA5E-443F-A773-7C992E54209E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0E5AD562-FA5E-443F-A773-7C992E54209E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0E5AD562-FA5E-443F-A773-7C992E54209E}.Debug|ARM.ActiveCfg = Debug|Any CPU - {0E5AD562-FA5E-443F-A773-7C992E54209E}.Debug|x64.ActiveCfg = Debug|Any CPU - {0E5AD562-FA5E-443F-A773-7C992E54209E}.Debug|x86.ActiveCfg = Debug|Any CPU - {0E5AD562-FA5E-443F-A773-7C992E54209E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0E5AD562-FA5E-443F-A773-7C992E54209E}.Release|Any CPU.Build.0 = Release|Any CPU - {0E5AD562-FA5E-443F-A773-7C992E54209E}.Release|ARM.ActiveCfg = Release|Any CPU - {0E5AD562-FA5E-443F-A773-7C992E54209E}.Release|x64.ActiveCfg = Release|Any CPU - {0E5AD562-FA5E-443F-A773-7C992E54209E}.Release|x86.ActiveCfg = Release|Any CPU - {9C42B357-7E5D-4192-850D-190EAEC0416A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9C42B357-7E5D-4192-850D-190EAEC0416A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9C42B357-7E5D-4192-850D-190EAEC0416A}.Debug|ARM.ActiveCfg = Debug|Any CPU - {9C42B357-7E5D-4192-850D-190EAEC0416A}.Debug|x64.ActiveCfg = Debug|Any CPU - {9C42B357-7E5D-4192-850D-190EAEC0416A}.Debug|x86.ActiveCfg = Debug|Any CPU - {9C42B357-7E5D-4192-850D-190EAEC0416A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9C42B357-7E5D-4192-850D-190EAEC0416A}.Release|Any CPU.Build.0 = Release|Any CPU - {9C42B357-7E5D-4192-850D-190EAEC0416A}.Release|ARM.ActiveCfg = Release|Any CPU - {9C42B357-7E5D-4192-850D-190EAEC0416A}.Release|x64.ActiveCfg = Release|Any CPU - {9C42B357-7E5D-4192-850D-190EAEC0416A}.Release|x86.ActiveCfg = Release|Any CPU - {A6D741FB-B974-491A-A2CE-DE7F491FD66D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A6D741FB-B974-491A-A2CE-DE7F491FD66D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A6D741FB-B974-491A-A2CE-DE7F491FD66D}.Debug|ARM.ActiveCfg = Debug|Any CPU - {A6D741FB-B974-491A-A2CE-DE7F491FD66D}.Debug|x64.ActiveCfg = Debug|Any CPU - {A6D741FB-B974-491A-A2CE-DE7F491FD66D}.Debug|x86.ActiveCfg = Debug|Any CPU - {A6D741FB-B974-491A-A2CE-DE7F491FD66D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A6D741FB-B974-491A-A2CE-DE7F491FD66D}.Release|Any CPU.Build.0 = Release|Any CPU - {A6D741FB-B974-491A-A2CE-DE7F491FD66D}.Release|ARM.ActiveCfg = Release|Any CPU - {A6D741FB-B974-491A-A2CE-DE7F491FD66D}.Release|x64.ActiveCfg = Release|Any CPU - {A6D741FB-B974-491A-A2CE-DE7F491FD66D}.Release|x86.ActiveCfg = Release|Any CPU - {175B67BE-9042-45EE-A8DF-D96FE8B75561}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {175B67BE-9042-45EE-A8DF-D96FE8B75561}.Debug|Any CPU.Build.0 = Debug|Any CPU - {175B67BE-9042-45EE-A8DF-D96FE8B75561}.Debug|ARM.ActiveCfg = Debug|Any CPU - {175B67BE-9042-45EE-A8DF-D96FE8B75561}.Debug|x64.ActiveCfg = Debug|Any CPU - {175B67BE-9042-45EE-A8DF-D96FE8B75561}.Debug|x86.ActiveCfg = Debug|Any CPU - {175B67BE-9042-45EE-A8DF-D96FE8B75561}.Release|Any CPU.ActiveCfg = Release|Any CPU - {175B67BE-9042-45EE-A8DF-D96FE8B75561}.Release|Any CPU.Build.0 = Release|Any CPU - {175B67BE-9042-45EE-A8DF-D96FE8B75561}.Release|ARM.ActiveCfg = Release|Any CPU - {175B67BE-9042-45EE-A8DF-D96FE8B75561}.Release|x64.ActiveCfg = Release|Any CPU - {175B67BE-9042-45EE-A8DF-D96FE8B75561}.Release|x86.ActiveCfg = Release|Any CPU - {F156F957-A86C-43BD-8957-29F464BFBED0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F156F957-A86C-43BD-8957-29F464BFBED0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F156F957-A86C-43BD-8957-29F464BFBED0}.Debug|ARM.ActiveCfg = Debug|Any CPU - {F156F957-A86C-43BD-8957-29F464BFBED0}.Debug|x64.ActiveCfg = Debug|Any CPU - {F156F957-A86C-43BD-8957-29F464BFBED0}.Debug|x86.ActiveCfg = Debug|Any CPU - {F156F957-A86C-43BD-8957-29F464BFBED0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F156F957-A86C-43BD-8957-29F464BFBED0}.Release|Any CPU.Build.0 = Release|Any CPU - {F156F957-A86C-43BD-8957-29F464BFBED0}.Release|ARM.ActiveCfg = Release|Any CPU - {F156F957-A86C-43BD-8957-29F464BFBED0}.Release|x64.ActiveCfg = Release|Any CPU - {F156F957-A86C-43BD-8957-29F464BFBED0}.Release|x86.ActiveCfg = Release|Any CPU - {D009CCA7-212D-43AC-BB0D-803F902526CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D009CCA7-212D-43AC-BB0D-803F902526CA}.Debug|ARM.ActiveCfg = Debug|ARM - {D009CCA7-212D-43AC-BB0D-803F902526CA}.Debug|ARM.Build.0 = Debug|ARM - {D009CCA7-212D-43AC-BB0D-803F902526CA}.Debug|x64.ActiveCfg = Debug|x64 - {D009CCA7-212D-43AC-BB0D-803F902526CA}.Debug|x64.Build.0 = Debug|x64 - {D009CCA7-212D-43AC-BB0D-803F902526CA}.Debug|x86.ActiveCfg = Debug|x86 - {D009CCA7-212D-43AC-BB0D-803F902526CA}.Debug|x86.Build.0 = Debug|x86 - {D009CCA7-212D-43AC-BB0D-803F902526CA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D009CCA7-212D-43AC-BB0D-803F902526CA}.Release|ARM.ActiveCfg = Release|ARM - {D009CCA7-212D-43AC-BB0D-803F902526CA}.Release|ARM.Build.0 = Release|ARM - {D009CCA7-212D-43AC-BB0D-803F902526CA}.Release|x64.ActiveCfg = Release|x64 - {D009CCA7-212D-43AC-BB0D-803F902526CA}.Release|x64.Build.0 = Release|x64 - {D009CCA7-212D-43AC-BB0D-803F902526CA}.Release|x86.ActiveCfg = Release|x86 - {D009CCA7-212D-43AC-BB0D-803F902526CA}.Release|x86.Build.0 = Release|x86 - {893A7FD4-62E6-4F7A-8FF9-EA502ADA88FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {893A7FD4-62E6-4F7A-8FF9-EA502ADA88FA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {893A7FD4-62E6-4F7A-8FF9-EA502ADA88FA}.Debug|ARM.ActiveCfg = Debug|Any CPU - {893A7FD4-62E6-4F7A-8FF9-EA502ADA88FA}.Debug|x64.ActiveCfg = Debug|Any CPU - {893A7FD4-62E6-4F7A-8FF9-EA502ADA88FA}.Debug|x86.ActiveCfg = Debug|Any CPU - {893A7FD4-62E6-4F7A-8FF9-EA502ADA88FA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {893A7FD4-62E6-4F7A-8FF9-EA502ADA88FA}.Release|Any CPU.Build.0 = Release|Any CPU - {893A7FD4-62E6-4F7A-8FF9-EA502ADA88FA}.Release|ARM.ActiveCfg = Release|Any CPU - {893A7FD4-62E6-4F7A-8FF9-EA502ADA88FA}.Release|x64.ActiveCfg = Release|Any CPU - {893A7FD4-62E6-4F7A-8FF9-EA502ADA88FA}.Release|x86.ActiveCfg = Release|Any CPU - {19495A45-67A8-460D-806C-CF158B96BBE9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {19495A45-67A8-460D-806C-CF158B96BBE9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {19495A45-67A8-460D-806C-CF158B96BBE9}.Debug|ARM.ActiveCfg = Debug|Any CPU - {19495A45-67A8-460D-806C-CF158B96BBE9}.Debug|x64.ActiveCfg = Debug|Any CPU - {19495A45-67A8-460D-806C-CF158B96BBE9}.Debug|x86.ActiveCfg = Debug|Any CPU - {19495A45-67A8-460D-806C-CF158B96BBE9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {19495A45-67A8-460D-806C-CF158B96BBE9}.Release|Any CPU.Build.0 = Release|Any CPU - {19495A45-67A8-460D-806C-CF158B96BBE9}.Release|ARM.ActiveCfg = Release|Any CPU - {19495A45-67A8-460D-806C-CF158B96BBE9}.Release|x64.ActiveCfg = Release|Any CPU - {19495A45-67A8-460D-806C-CF158B96BBE9}.Release|x86.ActiveCfg = Release|Any CPU - {19727F77-249A-4AC9-859C-8441E5BD41C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {19727F77-249A-4AC9-859C-8441E5BD41C4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {19727F77-249A-4AC9-859C-8441E5BD41C4}.Debug|ARM.ActiveCfg = Debug|Any CPU - {19727F77-249A-4AC9-859C-8441E5BD41C4}.Debug|x64.ActiveCfg = Debug|Any CPU - {19727F77-249A-4AC9-859C-8441E5BD41C4}.Debug|x86.ActiveCfg = Debug|Any CPU - {19727F77-249A-4AC9-859C-8441E5BD41C4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {19727F77-249A-4AC9-859C-8441E5BD41C4}.Release|Any CPU.Build.0 = Release|Any CPU - {19727F77-249A-4AC9-859C-8441E5BD41C4}.Release|ARM.ActiveCfg = Release|Any CPU - {19727F77-249A-4AC9-859C-8441E5BD41C4}.Release|x64.ActiveCfg = Release|Any CPU - {19727F77-249A-4AC9-859C-8441E5BD41C4}.Release|x86.ActiveCfg = Release|Any CPU - {51E43E76-A342-42D3-A8AD-ABC45CEBD9C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {51E43E76-A342-42D3-A8AD-ABC45CEBD9C5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {51E43E76-A342-42D3-A8AD-ABC45CEBD9C5}.Debug|ARM.ActiveCfg = Debug|Any CPU - {51E43E76-A342-42D3-A8AD-ABC45CEBD9C5}.Debug|x64.ActiveCfg = Debug|Any CPU - {51E43E76-A342-42D3-A8AD-ABC45CEBD9C5}.Debug|x86.ActiveCfg = Debug|Any CPU - {51E43E76-A342-42D3-A8AD-ABC45CEBD9C5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {51E43E76-A342-42D3-A8AD-ABC45CEBD9C5}.Release|Any CPU.Build.0 = Release|Any CPU - {51E43E76-A342-42D3-A8AD-ABC45CEBD9C5}.Release|ARM.ActiveCfg = Release|Any CPU - {51E43E76-A342-42D3-A8AD-ABC45CEBD9C5}.Release|x64.ActiveCfg = Release|Any CPU - {51E43E76-A342-42D3-A8AD-ABC45CEBD9C5}.Release|x86.ActiveCfg = Release|Any CPU - {80D861DB-FC7B-4DF7-8D87-750EEFC82B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {80D861DB-FC7B-4DF7-8D87-750EEFC82B46}.Debug|Any CPU.Build.0 = Debug|Any CPU - {80D861DB-FC7B-4DF7-8D87-750EEFC82B46}.Debug|ARM.ActiveCfg = Debug|Any CPU - {80D861DB-FC7B-4DF7-8D87-750EEFC82B46}.Debug|x64.ActiveCfg = Debug|Any CPU - {80D861DB-FC7B-4DF7-8D87-750EEFC82B46}.Debug|x86.ActiveCfg = Debug|Any CPU - {80D861DB-FC7B-4DF7-8D87-750EEFC82B46}.Release|Any CPU.ActiveCfg = Release|Any CPU - {80D861DB-FC7B-4DF7-8D87-750EEFC82B46}.Release|Any CPU.Build.0 = Release|Any CPU - {80D861DB-FC7B-4DF7-8D87-750EEFC82B46}.Release|ARM.ActiveCfg = Release|Any CPU - {80D861DB-FC7B-4DF7-8D87-750EEFC82B46}.Release|x64.ActiveCfg = Release|Any CPU - {80D861DB-FC7B-4DF7-8D87-750EEFC82B46}.Release|x86.ActiveCfg = Release|Any CPU - {1D73A9E4-7F61-4288-BDE1-E13CC63872C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1D73A9E4-7F61-4288-BDE1-E13CC63872C0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1D73A9E4-7F61-4288-BDE1-E13CC63872C0}.Debug|ARM.ActiveCfg = Debug|Any CPU - {1D73A9E4-7F61-4288-BDE1-E13CC63872C0}.Debug|x64.ActiveCfg = Debug|Any CPU - {1D73A9E4-7F61-4288-BDE1-E13CC63872C0}.Debug|x86.ActiveCfg = Debug|Any CPU - {1D73A9E4-7F61-4288-BDE1-E13CC63872C0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1D73A9E4-7F61-4288-BDE1-E13CC63872C0}.Release|Any CPU.Build.0 = Release|Any CPU - {1D73A9E4-7F61-4288-BDE1-E13CC63872C0}.Release|ARM.ActiveCfg = Release|Any CPU - {1D73A9E4-7F61-4288-BDE1-E13CC63872C0}.Release|x64.ActiveCfg = Release|Any CPU - {1D73A9E4-7F61-4288-BDE1-E13CC63872C0}.Release|x86.ActiveCfg = Release|Any CPU - {C7CB8AC5-E948-4738-B440-ECAE8656667F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C7CB8AC5-E948-4738-B440-ECAE8656667F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C7CB8AC5-E948-4738-B440-ECAE8656667F}.Debug|ARM.ActiveCfg = Debug|Any CPU - {C7CB8AC5-E948-4738-B440-ECAE8656667F}.Debug|x64.ActiveCfg = Debug|Any CPU - {C7CB8AC5-E948-4738-B440-ECAE8656667F}.Debug|x86.ActiveCfg = Debug|Any CPU - {C7CB8AC5-E948-4738-B440-ECAE8656667F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C7CB8AC5-E948-4738-B440-ECAE8656667F}.Release|Any CPU.Build.0 = Release|Any CPU - {C7CB8AC5-E948-4738-B440-ECAE8656667F}.Release|ARM.ActiveCfg = Release|Any CPU - {C7CB8AC5-E948-4738-B440-ECAE8656667F}.Release|x64.ActiveCfg = Release|Any CPU - {C7CB8AC5-E948-4738-B440-ECAE8656667F}.Release|x86.ActiveCfg = Release|Any CPU - {E0D59BBD-CF69-40E9-8023-C113DCEBC0AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E0D59BBD-CF69-40E9-8023-C113DCEBC0AF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E0D59BBD-CF69-40E9-8023-C113DCEBC0AF}.Debug|ARM.ActiveCfg = Debug|Any CPU - {E0D59BBD-CF69-40E9-8023-C113DCEBC0AF}.Debug|x64.ActiveCfg = Debug|Any CPU - {E0D59BBD-CF69-40E9-8023-C113DCEBC0AF}.Debug|x86.ActiveCfg = Debug|Any CPU - {E0D59BBD-CF69-40E9-8023-C113DCEBC0AF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E0D59BBD-CF69-40E9-8023-C113DCEBC0AF}.Release|Any CPU.Build.0 = Release|Any CPU - {E0D59BBD-CF69-40E9-8023-C113DCEBC0AF}.Release|ARM.ActiveCfg = Release|Any CPU - {E0D59BBD-CF69-40E9-8023-C113DCEBC0AF}.Release|x64.ActiveCfg = Release|Any CPU - {E0D59BBD-CF69-40E9-8023-C113DCEBC0AF}.Release|x86.ActiveCfg = Release|Any CPU - {42AB07F9-CEB2-4A5B-A8FC-B7A85AD4DFD3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {42AB07F9-CEB2-4A5B-A8FC-B7A85AD4DFD3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {42AB07F9-CEB2-4A5B-A8FC-B7A85AD4DFD3}.Debug|ARM.ActiveCfg = Debug|Any CPU - {42AB07F9-CEB2-4A5B-A8FC-B7A85AD4DFD3}.Debug|x64.ActiveCfg = Debug|Any CPU - {42AB07F9-CEB2-4A5B-A8FC-B7A85AD4DFD3}.Debug|x86.ActiveCfg = Debug|Any CPU - {42AB07F9-CEB2-4A5B-A8FC-B7A85AD4DFD3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {42AB07F9-CEB2-4A5B-A8FC-B7A85AD4DFD3}.Release|Any CPU.Build.0 = Release|Any CPU - {42AB07F9-CEB2-4A5B-A8FC-B7A85AD4DFD3}.Release|ARM.ActiveCfg = Release|Any CPU - {42AB07F9-CEB2-4A5B-A8FC-B7A85AD4DFD3}.Release|x64.ActiveCfg = Release|Any CPU - {42AB07F9-CEB2-4A5B-A8FC-B7A85AD4DFD3}.Release|x86.ActiveCfg = Release|Any CPU - {C59BD98A-2C25-4F1D-A860-751AE1F800EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C59BD98A-2C25-4F1D-A860-751AE1F800EB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C59BD98A-2C25-4F1D-A860-751AE1F800EB}.Debug|ARM.ActiveCfg = Debug|Any CPU - {C59BD98A-2C25-4F1D-A860-751AE1F800EB}.Debug|x64.ActiveCfg = Debug|Any CPU - {C59BD98A-2C25-4F1D-A860-751AE1F800EB}.Debug|x86.ActiveCfg = Debug|Any CPU - {C59BD98A-2C25-4F1D-A860-751AE1F800EB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C59BD98A-2C25-4F1D-A860-751AE1F800EB}.Release|Any CPU.Build.0 = Release|Any CPU - {C59BD98A-2C25-4F1D-A860-751AE1F800EB}.Release|ARM.ActiveCfg = Release|Any CPU - {C59BD98A-2C25-4F1D-A860-751AE1F800EB}.Release|x64.ActiveCfg = Release|Any CPU - {C59BD98A-2C25-4F1D-A860-751AE1F800EB}.Release|x86.ActiveCfg = Release|Any CPU - {AD101432-1950-4F01-825A-7D108B30DA35}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AD101432-1950-4F01-825A-7D108B30DA35}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AD101432-1950-4F01-825A-7D108B30DA35}.Debug|ARM.ActiveCfg = Debug|Any CPU - {AD101432-1950-4F01-825A-7D108B30DA35}.Debug|x64.ActiveCfg = Debug|Any CPU - {AD101432-1950-4F01-825A-7D108B30DA35}.Debug|x86.ActiveCfg = Debug|Any CPU - {AD101432-1950-4F01-825A-7D108B30DA35}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AD101432-1950-4F01-825A-7D108B30DA35}.Release|Any CPU.Build.0 = Release|Any CPU - {AD101432-1950-4F01-825A-7D108B30DA35}.Release|ARM.ActiveCfg = Release|Any CPU - {AD101432-1950-4F01-825A-7D108B30DA35}.Release|x64.ActiveCfg = Release|Any CPU - {AD101432-1950-4F01-825A-7D108B30DA35}.Release|x86.ActiveCfg = Release|Any CPU - {50F8A9BC-CA87-48D0-BA18-32DF5F50A97A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {50F8A9BC-CA87-48D0-BA18-32DF5F50A97A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {50F8A9BC-CA87-48D0-BA18-32DF5F50A97A}.Debug|ARM.ActiveCfg = Debug|Any CPU - {50F8A9BC-CA87-48D0-BA18-32DF5F50A97A}.Debug|x64.ActiveCfg = Debug|Any CPU - {50F8A9BC-CA87-48D0-BA18-32DF5F50A97A}.Debug|x86.ActiveCfg = Debug|Any CPU - {50F8A9BC-CA87-48D0-BA18-32DF5F50A97A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {50F8A9BC-CA87-48D0-BA18-32DF5F50A97A}.Release|Any CPU.Build.0 = Release|Any CPU - {50F8A9BC-CA87-48D0-BA18-32DF5F50A97A}.Release|ARM.ActiveCfg = Release|Any CPU - {50F8A9BC-CA87-48D0-BA18-32DF5F50A97A}.Release|x64.ActiveCfg = Release|Any CPU - {50F8A9BC-CA87-48D0-BA18-32DF5F50A97A}.Release|x86.ActiveCfg = Release|Any CPU - {0765606F-88B9-4682-80D3-64E612ADCB81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0765606F-88B9-4682-80D3-64E612ADCB81}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0765606F-88B9-4682-80D3-64E612ADCB81}.Debug|ARM.ActiveCfg = Debug|Any CPU - {0765606F-88B9-4682-80D3-64E612ADCB81}.Debug|x64.ActiveCfg = Debug|Any CPU - {0765606F-88B9-4682-80D3-64E612ADCB81}.Debug|x86.ActiveCfg = Debug|Any CPU - {0765606F-88B9-4682-80D3-64E612ADCB81}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0765606F-88B9-4682-80D3-64E612ADCB81}.Release|Any CPU.Build.0 = Release|Any CPU - {0765606F-88B9-4682-80D3-64E612ADCB81}.Release|ARM.ActiveCfg = Release|Any CPU - {0765606F-88B9-4682-80D3-64E612ADCB81}.Release|x64.ActiveCfg = Release|Any CPU - {0765606F-88B9-4682-80D3-64E612ADCB81}.Release|x86.ActiveCfg = Release|Any CPU - {F60EC4EC-B969-4E8E-8E15-374BFACF99CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F60EC4EC-B969-4E8E-8E15-374BFACF99CF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F60EC4EC-B969-4E8E-8E15-374BFACF99CF}.Debug|ARM.ActiveCfg = Debug|Any CPU - {F60EC4EC-B969-4E8E-8E15-374BFACF99CF}.Debug|x64.ActiveCfg = Debug|Any CPU - {F60EC4EC-B969-4E8E-8E15-374BFACF99CF}.Debug|x86.ActiveCfg = Debug|Any CPU - {F60EC4EC-B969-4E8E-8E15-374BFACF99CF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F60EC4EC-B969-4E8E-8E15-374BFACF99CF}.Release|Any CPU.Build.0 = Release|Any CPU - {F60EC4EC-B969-4E8E-8E15-374BFACF99CF}.Release|ARM.ActiveCfg = Release|Any CPU - {F60EC4EC-B969-4E8E-8E15-374BFACF99CF}.Release|x64.ActiveCfg = Release|Any CPU - {F60EC4EC-B969-4E8E-8E15-374BFACF99CF}.Release|x86.ActiveCfg = Release|Any CPU - {55341205-ACB8-4E7D-8E39-0629AA8C2C32}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {55341205-ACB8-4E7D-8E39-0629AA8C2C32}.Debug|Any CPU.Build.0 = Debug|Any CPU - {55341205-ACB8-4E7D-8E39-0629AA8C2C32}.Debug|ARM.ActiveCfg = Debug|Any CPU - {55341205-ACB8-4E7D-8E39-0629AA8C2C32}.Debug|x64.ActiveCfg = Debug|Any CPU - {55341205-ACB8-4E7D-8E39-0629AA8C2C32}.Debug|x86.ActiveCfg = Debug|Any CPU - {55341205-ACB8-4E7D-8E39-0629AA8C2C32}.Release|Any CPU.ActiveCfg = Release|Any CPU - {55341205-ACB8-4E7D-8E39-0629AA8C2C32}.Release|Any CPU.Build.0 = Release|Any CPU - {55341205-ACB8-4E7D-8E39-0629AA8C2C32}.Release|ARM.ActiveCfg = Release|Any CPU - {55341205-ACB8-4E7D-8E39-0629AA8C2C32}.Release|x64.ActiveCfg = Release|Any CPU - {55341205-ACB8-4E7D-8E39-0629AA8C2C32}.Release|x86.ActiveCfg = Release|Any CPU - {F354D8B6-F293-45ED-AF9B-B746E1232C17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F354D8B6-F293-45ED-AF9B-B746E1232C17}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F354D8B6-F293-45ED-AF9B-B746E1232C17}.Debug|ARM.ActiveCfg = Debug|Any CPU - {F354D8B6-F293-45ED-AF9B-B746E1232C17}.Debug|x64.ActiveCfg = Debug|Any CPU - {F354D8B6-F293-45ED-AF9B-B746E1232C17}.Debug|x86.ActiveCfg = Debug|Any CPU - {F354D8B6-F293-45ED-AF9B-B746E1232C17}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F354D8B6-F293-45ED-AF9B-B746E1232C17}.Release|Any CPU.Build.0 = Release|Any CPU - {F354D8B6-F293-45ED-AF9B-B746E1232C17}.Release|ARM.ActiveCfg = Release|Any CPU - {F354D8B6-F293-45ED-AF9B-B746E1232C17}.Release|x64.ActiveCfg = Release|Any CPU - {F354D8B6-F293-45ED-AF9B-B746E1232C17}.Release|x86.ActiveCfg = Release|Any CPU - {C54EFA11-B338-4E08-8718-595AEE63BA04}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C54EFA11-B338-4E08-8718-595AEE63BA04}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C54EFA11-B338-4E08-8718-595AEE63BA04}.Debug|ARM.ActiveCfg = Debug|ARM - {C54EFA11-B338-4E08-8718-595AEE63BA04}.Debug|ARM.Build.0 = Debug|ARM - {C54EFA11-B338-4E08-8718-595AEE63BA04}.Debug|x64.ActiveCfg = Debug|Any CPU - {C54EFA11-B338-4E08-8718-595AEE63BA04}.Debug|x86.ActiveCfg = Debug|x86 - {C54EFA11-B338-4E08-8718-595AEE63BA04}.Debug|x86.Build.0 = Debug|x86 - {C54EFA11-B338-4E08-8718-595AEE63BA04}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C54EFA11-B338-4E08-8718-595AEE63BA04}.Release|Any CPU.Build.0 = Release|Any CPU - {C54EFA11-B338-4E08-8718-595AEE63BA04}.Release|ARM.ActiveCfg = Release|ARM - {C54EFA11-B338-4E08-8718-595AEE63BA04}.Release|ARM.Build.0 = Release|ARM - {C54EFA11-B338-4E08-8718-595AEE63BA04}.Release|x64.ActiveCfg = Release|Any CPU - {C54EFA11-B338-4E08-8718-595AEE63BA04}.Release|x86.ActiveCfg = Release|x86 - {C54EFA11-B338-4E08-8718-595AEE63BA04}.Release|x86.Build.0 = Release|x86 - {81AFF745-6E02-4AFE-A871-3B86AEED1E1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {81AFF745-6E02-4AFE-A871-3B86AEED1E1B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {81AFF745-6E02-4AFE-A871-3B86AEED1E1B}.Debug|ARM.ActiveCfg = Debug|ARM - {81AFF745-6E02-4AFE-A871-3B86AEED1E1B}.Debug|ARM.Build.0 = Debug|ARM - {81AFF745-6E02-4AFE-A871-3B86AEED1E1B}.Debug|x64.ActiveCfg = Debug|Any CPU - {81AFF745-6E02-4AFE-A871-3B86AEED1E1B}.Debug|x86.ActiveCfg = Debug|x86 - {81AFF745-6E02-4AFE-A871-3B86AEED1E1B}.Debug|x86.Build.0 = Debug|x86 - {81AFF745-6E02-4AFE-A871-3B86AEED1E1B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {81AFF745-6E02-4AFE-A871-3B86AEED1E1B}.Release|Any CPU.Build.0 = Release|Any CPU - {81AFF745-6E02-4AFE-A871-3B86AEED1E1B}.Release|ARM.ActiveCfg = Release|ARM - {81AFF745-6E02-4AFE-A871-3B86AEED1E1B}.Release|ARM.Build.0 = Release|ARM - {81AFF745-6E02-4AFE-A871-3B86AEED1E1B}.Release|x64.ActiveCfg = Release|Any CPU - {81AFF745-6E02-4AFE-A871-3B86AEED1E1B}.Release|x86.ActiveCfg = Release|x86 - {81AFF745-6E02-4AFE-A871-3B86AEED1E1B}.Release|x86.Build.0 = Release|x86 - {50AF7833-C345-4F6C-9FB1-36EB176D68E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {50AF7833-C345-4F6C-9FB1-36EB176D68E1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {50AF7833-C345-4F6C-9FB1-36EB176D68E1}.Debug|ARM.ActiveCfg = Debug|Any CPU - {50AF7833-C345-4F6C-9FB1-36EB176D68E1}.Debug|x64.ActiveCfg = Debug|Any CPU - {50AF7833-C345-4F6C-9FB1-36EB176D68E1}.Debug|x86.ActiveCfg = Debug|Any CPU - {50AF7833-C345-4F6C-9FB1-36EB176D68E1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {50AF7833-C345-4F6C-9FB1-36EB176D68E1}.Release|Any CPU.Build.0 = Release|Any CPU - {50AF7833-C345-4F6C-9FB1-36EB176D68E1}.Release|ARM.ActiveCfg = Release|Any CPU - {50AF7833-C345-4F6C-9FB1-36EB176D68E1}.Release|x64.ActiveCfg = Release|Any CPU - {50AF7833-C345-4F6C-9FB1-36EB176D68E1}.Release|x86.ActiveCfg = Release|Any CPU - {1B365EA8-743C-4105-B86D-FF412DAD0DAF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1B365EA8-743C-4105-B86D-FF412DAD0DAF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1B365EA8-743C-4105-B86D-FF412DAD0DAF}.Debug|ARM.ActiveCfg = Debug|Any CPU - {1B365EA8-743C-4105-B86D-FF412DAD0DAF}.Debug|x64.ActiveCfg = Debug|Any CPU - {1B365EA8-743C-4105-B86D-FF412DAD0DAF}.Debug|x86.ActiveCfg = Debug|Any CPU - {1B365EA8-743C-4105-B86D-FF412DAD0DAF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1B365EA8-743C-4105-B86D-FF412DAD0DAF}.Release|Any CPU.Build.0 = Release|Any CPU - {1B365EA8-743C-4105-B86D-FF412DAD0DAF}.Release|ARM.ActiveCfg = Release|Any CPU - {1B365EA8-743C-4105-B86D-FF412DAD0DAF}.Release|x64.ActiveCfg = Release|Any CPU - {1B365EA8-743C-4105-B86D-FF412DAD0DAF}.Release|x86.ActiveCfg = Release|Any CPU - {24E9D52C-6679-47E1-A2C6-6FEB34C79712}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {24E9D52C-6679-47E1-A2C6-6FEB34C79712}.Debug|ARM.ActiveCfg = Debug|Any CPU - {24E9D52C-6679-47E1-A2C6-6FEB34C79712}.Debug|x64.ActiveCfg = Debug|Any CPU - {24E9D52C-6679-47E1-A2C6-6FEB34C79712}.Debug|x86.ActiveCfg = Debug|Any CPU - {24E9D52C-6679-47E1-A2C6-6FEB34C79712}.Release|Any CPU.ActiveCfg = Release|Any CPU - {24E9D52C-6679-47E1-A2C6-6FEB34C79712}.Release|ARM.ActiveCfg = Release|Any CPU - {24E9D52C-6679-47E1-A2C6-6FEB34C79712}.Release|x64.ActiveCfg = Release|Any CPU - {24E9D52C-6679-47E1-A2C6-6FEB34C79712}.Release|x86.ActiveCfg = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {A842E52E-4001-4BD8-BDCD-C95630D984D4} = {D6B06B88-8371-4360-B47E-8A772B92323A} - {09CD285E-A097-4C38-8598-5A9BE0557030} = {D6B06B88-8371-4360-B47E-8A772B92323A} - {09A84445-2AA3-4D99-89F7-007CA3EF91A3} = {A3324369-1E2D-495C-8E96-109B6F98F003} - {CFDFCEA2-BAFB-455E-BEF4-40343DE968CF} = {B70211DF-4DB4-4D29-842C-1CE527BD1EFC} - {7E6D5FC5-4ED0-433C-A92C-D4A0C0146CCB} = {B70211DF-4DB4-4D29-842C-1CE527BD1EFC} - {0E5AD562-FA5E-443F-A773-7C992E54209E} = {B70211DF-4DB4-4D29-842C-1CE527BD1EFC} - {9C42B357-7E5D-4192-850D-190EAEC0416A} = {D6B06B88-8371-4360-B47E-8A772B92323A} - {A6D741FB-B974-491A-A2CE-DE7F491FD66D} = {A3324369-1E2D-495C-8E96-109B6F98F003} - {175B67BE-9042-45EE-A8DF-D96FE8B75561} = {D6B06B88-8371-4360-B47E-8A772B92323A} - {F156F957-A86C-43BD-8957-29F464BFBED0} = {A3324369-1E2D-495C-8E96-109B6F98F003} - {D009CCA7-212D-43AC-BB0D-803F902526CA} = {B70211DF-4DB4-4D29-842C-1CE527BD1EFC} - {893A7FD4-62E6-4F7A-8FF9-EA502ADA88FA} = {559DC157-DDC9-44BA-B25D-0A18E286D1CC} - {19495A45-67A8-460D-806C-CF158B96BBE9} = {C3406DF1-E92C-4100-BEF9-B49F616E77C5} - {19727F77-249A-4AC9-859C-8441E5BD41C4} = {C3406DF1-E92C-4100-BEF9-B49F616E77C5} - {51E43E76-A342-42D3-A8AD-ABC45CEBD9C5} = {C3406DF1-E92C-4100-BEF9-B49F616E77C5} - {80D861DB-FC7B-4DF7-8D87-750EEFC82B46} = {559DC157-DDC9-44BA-B25D-0A18E286D1CC} - {1D73A9E4-7F61-4288-BDE1-E13CC63872C0} = {B9ACA570-A4AC-4AC9-95E2-A95BCEDBD866} - {C7CB8AC5-E948-4738-B440-ECAE8656667F} = {B9ACA570-A4AC-4AC9-95E2-A95BCEDBD866} - {E0D59BBD-CF69-40E9-8023-C113DCEBC0AF} = {B9ACA570-A4AC-4AC9-95E2-A95BCEDBD866} - {42AB07F9-CEB2-4A5B-A8FC-B7A85AD4DFD3} = {B9ACA570-A4AC-4AC9-95E2-A95BCEDBD866} - {C59BD98A-2C25-4F1D-A860-751AE1F800EB} = {559DC157-DDC9-44BA-B25D-0A18E286D1CC} - {AD101432-1950-4F01-825A-7D108B30DA35} = {C3406DF1-E92C-4100-BEF9-B49F616E77C5} - {50F8A9BC-CA87-48D0-BA18-32DF5F50A97A} = {559DC157-DDC9-44BA-B25D-0A18E286D1CC} - {0765606F-88B9-4682-80D3-64E612ADCB81} = {559DC157-DDC9-44BA-B25D-0A18E286D1CC} - {F60EC4EC-B969-4E8E-8E15-374BFACF99CF} = {B9ACA570-A4AC-4AC9-95E2-A95BCEDBD866} - {55341205-ACB8-4E7D-8E39-0629AA8C2C32} = {B9ACA570-A4AC-4AC9-95E2-A95BCEDBD866} - {F354D8B6-F293-45ED-AF9B-B746E1232C17} = {559DC157-DDC9-44BA-B25D-0A18E286D1CC} - {C54EFA11-B338-4E08-8718-595AEE63BA04} = {B70211DF-4DB4-4D29-842C-1CE527BD1EFC} - {81AFF745-6E02-4AFE-A871-3B86AEED1E1B} = {B70211DF-4DB4-4D29-842C-1CE527BD1EFC} - {50AF7833-C345-4F6C-9FB1-36EB176D68E1} = {C3406DF1-E92C-4100-BEF9-B49F616E77C5} - {1B365EA8-743C-4105-B86D-FF412DAD0DAF} = {D6B06B88-8371-4360-B47E-8A772B92323A} - {24E9D52C-6679-47E1-A2C6-6FEB34C79712} = {A3324369-1E2D-495C-8E96-109B6F98F003} - EndGlobalSection - GlobalSection(TestCaseManagementSettings) = postSolution - CategoryFile = SrkToolkit.vsmdi - EndGlobalSection -EndGlobal From 4b11ed7ca7fca016997688ab2ef1ad18c075f0bd Mon Sep 17 00:00:00 2001 From: SandRock Date: Mon, 27 Mar 2023 17:12:08 +0200 Subject: [PATCH 19/34] SrkToolkit.AspNetCore2: restore many unit tests (WIP) --- .../AspNetCoreTestContext.cs | 193 ++++++++++++++ .../SrkHtmlExtensionsTests.cs | 246 ++++++++++++------ .../SrkHttpContextExtensionsTests.cs | 40 ++- .../SrkRequestExtensionsTests.cs | 30 ++- .../SrkToolkit.AspNetCore2.UnitTests.csproj | 7 +- .../SrkUrlHelperExtensionsTests.cs | 34 ++- .../Fakes/BasicHttpContext.cs | 4 +- .../SrkTagBuilderExtensions.cs | 5 +- .../SrkUrlHelperExtensions.cs | 9 +- 9 files changed, 436 insertions(+), 132 deletions(-) create mode 100644 Sources/SrkToolkit.AspNetCore2.UnitTests/AspNetCoreTestContext.cs diff --git a/Sources/SrkToolkit.AspNetCore2.UnitTests/AspNetCoreTestContext.cs b/Sources/SrkToolkit.AspNetCore2.UnitTests/AspNetCoreTestContext.cs new file mode 100644 index 0000000..9e1d3f3 --- /dev/null +++ b/Sources/SrkToolkit.AspNetCore2.UnitTests/AspNetCoreTestContext.cs @@ -0,0 +1,193 @@ + +namespace SrkToolkit.Web.Tests; + +using Microsoft.AspNetCore.Antiforgery; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Internal; +using Microsoft.AspNetCore.Mvc.ModelBinding; +using Microsoft.AspNetCore.Mvc.RazorPages; +using Microsoft.AspNetCore.Mvc.Rendering; +using Microsoft.AspNetCore.Mvc.Routing; +using Microsoft.AspNetCore.Mvc.ViewEngines; +using Microsoft.AspNetCore.Mvc.ViewFeatures; +using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal; +using Microsoft.AspNetCore.Routing; +using Microsoft.Extensions.Options; +using Microsoft.Extensions.WebEncoders.Testing; +using Moq; +using System; +using System.IO; +using System.Text.Encodings.Web; + +/// +/// Helps generate a HttpContext and all the ASP and MVC objects in order to do component testing. +/// +/// +public class AspNetCoreTestContext +{ + private readonly MockRepository mocks; + private DefaultHttpContext context; + private ViewDataDictionary viewDataDictionary; + private HtmlHelper html; + private T model; + private ModelStateDictionary modelState; + private IModelMetadataProvider metadataProvider = new EmptyModelMetadataProvider(); + private UrlHelper url; + private ActionContext action; + private RouteData routeData; + private TempDataDictionary tempData; + + /// + /// Helps generate a HttpContext and all the ASP and MVC objects in order to do component testing. + /// + public AspNetCoreTestContext() + : this(default(T)) + { + } + + /// + /// Helps generate a HttpContext and all the ASP and MVC objects in order to do component testing. + /// + /// + public AspNetCoreTestContext(T model) + { + this.Model = model; + this.mocks = new MockRepository(MockBehavior.Default); + } + + /// + /// Gets the instance (lazy). + /// + public HttpContext Context + { + get + { + if (this.context == null) + { + this.context = new DefaultHttpContext(); + } + + return this.context; + } + } + + /// + /// Gets the instance (lazy). + /// + public ActionContext ActionContext + { + get + { + if (this.action == null) + { + this.action = new ActionContext(this.Context, this.routeData = new RouteData(), new PageActionDescriptor(), this.ModelState); + } + + return this.action; + } + } + + /// + /// Gets the Model instance. + /// + public T Model + { + get => this.model; + set => this.model = value; + } + + /// + /// Gets the ModelState (lazy). + /// + public ModelStateDictionary ModelState + { + get + { + if (this.modelState == null) + { + this.modelState = new ModelStateDictionary(); + } + + return this.modelState; + } + } + + /// + /// Gets the (lazy). + /// + public ViewDataDictionary ViewData + { + get + { + if (this.viewDataDictionary == null) + { + this.viewDataDictionary = new ViewDataDictionary(this.metadataProvider, this.ModelState); + } + + return this.viewDataDictionary; + } + } + + /// + /// Gets the (lazy). + /// + public virtual IHtmlHelper Html + { + get + { + if (this.html == null) + { + var optionsAccessor = new OptionsWrapper(new MvcViewOptions()); + var htmlGenerator = new DefaultHtmlGenerator( + this.mocks.Create().Object, + optionsAccessor, + this.metadataProvider, + new UrlHelperFactory(), + HtmlEncoder.Default, + new DefaultValidationHtmlAttributeProvider(optionsAccessor, this.metadataProvider, new ClientValidatorCache())); + this.html = new HtmlHelper( + htmlGenerator, + new CompositeViewEngine(optionsAccessor), + this.metadataProvider, + new Mock().Object, + HtmlEncoder.Default, + new UrlTestEncoder(), + new ExpressionTextCache()); + var viewContext = new ViewContext( + this.ActionContext, + new NullView(), + this.ViewData, + this.tempData ?? (this.tempData = new TempDataDictionary(this.Context, new Mock().Object)), + new StringWriter(), + new HtmlHelperOptions()); + this.html.Contextualize(viewContext); + } + + return this.html; + } + } + + /// + /// Gets the (lazy). + /// + public IUrlHelper Url + { + get + { + if (this.url == null) + { + this.url = new UrlHelper(this.ActionContext); + } + + return this.url; + } + } +} + +/// +/// Helps generate a HttpContext and all the ASP and MVC objects in order to do component testing. +/// +public class AspNetCoreTestContext : AspNetCoreTestContext +{ +} \ No newline at end of file diff --git a/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkHtmlExtensionsTests.cs b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkHtmlExtensionsTests.cs index 7714591..6f91c55 100644 --- a/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkHtmlExtensionsTests.cs +++ b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkHtmlExtensionsTests.cs @@ -16,6 +16,7 @@ namespace SrkToolkit.Web.Tests { + using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Mvc.ViewEngines; @@ -32,16 +33,15 @@ namespace SrkToolkit.Web.Tests using System.Linq; using System.Text; using System.Threading; - using System.Web.Mvc; using Xunit; public class SrkHtmlExtensionsTests { public static readonly CultureInfo TestCulture1 = new CultureInfo("en-GB"); - +/* public static HtmlHelper CreateHtmlHelper(ViewDataDictionary vd) { - var httpContext = new BasicHttpContext(); + var httpContext = new DefaultHttpContext(); var mockViewContext = new ViewContext( new ControllerContext( httpContext, @@ -56,16 +56,23 @@ public static HtmlHelper CreateHtmlHelper(ViewDataDictionary vd) .Returns(vd); return new HtmlHelper(mockViewContext, mockViewDataContainer.Object); } - - public class SetTimezoneMethod - { - [Fact] +*/ + public class SetTimezoneMethod + { + private readonly AspNetCoreTestContext context; + + public SetTimezoneMethod() + { + this.context = new AspNetCoreTestContext(); + } + + [Fact] public void WorksWithTzObject1() - { - var data = new ViewDataDictionary(); - var tz = TimeZoneInfo.FindSystemTimeZoneById("Romance Standard Time"); - var html = CreateHtmlHelper(data); - SrkHtmlExtensions.SetTimezone(html, tz); + { + var data = this.context.ViewData; + var tz = TimeZoneInfo.FindSystemTimeZoneById("Romance Standard Time"); + var html = this.context.Html; + SrkHtmlExtensions.SetTimezone(html, tz); Assert.NotNull(data["Timezone"]); Assert.Equal(tz, data["Timezone"]); @@ -74,9 +81,9 @@ public void WorksWithTzObject1() [Fact] public void WorksWithTzObject2() { - var data = new ViewDataDictionary(); - var tz = TimeZoneInfo.FindSystemTimeZoneById("Russia Time Zone 3"); - var html = CreateHtmlHelper(data); + var data = this.context.ViewData; + var tz = TimeZoneInfo.FindSystemTimeZoneById("Russia Time Zone 3"); + var html = this.context.Html; SrkHtmlExtensions.SetTimezone(html, tz); Assert.NotNull(data["Timezone"]); @@ -86,10 +93,10 @@ public void WorksWithTzObject2() [Fact] public void WorksWithTzName1() { - var data = new ViewDataDictionary(); - var tzName = "Romance Standard Time"; + var data = this.context.ViewData; + var tzName = "Romance Standard Time"; var tz = TimeZoneInfo.FindSystemTimeZoneById(tzName); - var html = CreateHtmlHelper(data); + var html = this.context.Html; SrkHtmlExtensions.SetTimezone(html, tzName); Assert.NotNull(data["Timezone"]); @@ -99,47 +106,56 @@ public void WorksWithTzName1() [Fact] public void WorksWithTzName2() { - var data = new ViewDataDictionary(); + var data = this.context.ViewData; var tzName = "Russia Time Zone 3"; var tz = TimeZoneInfo.FindSystemTimeZoneById(tzName); - var html = CreateHtmlHelper(data); + var html = this.context.Html; SrkHtmlExtensions.SetTimezone(html, tzName); Assert.NotNull(data["Timezone"]); Assert.Equal(tz, data["Timezone"]); } - [Fact, ExpectedException(typeof(ArgumentException))] + [Fact] public void NullTzName() { string tzName = null; - var html = CreateHtmlHelper(new ViewDataDictionary()); - SrkHtmlExtensions.SetTimezone(html, tzName); - } - - [Fact, ExpectedException(typeof(ArgumentException))] + var html = this.context.Html; + Assert.Throws(() => + { + SrkHtmlExtensions.SetTimezone(html, tzName); + }); + } + + [Fact] public void EmptyTzName() { string tzName = string.Empty; - var html = CreateHtmlHelper(new ViewDataDictionary()); - SrkHtmlExtensions.SetTimezone(html, tzName); + var html = this.context.Html; + Assert.Throws(() => + { + SrkHtmlExtensions.SetTimezone(html, tzName); + }); } - [Fact, ExpectedException(typeof(TimeZoneNotFoundException))] + [Fact] public void InvalidTzName() { string tzName = "Lunar Standard Time"; - var html = CreateHtmlHelper(new ViewDataDictionary()); - SrkHtmlExtensions.SetTimezone(html, tzName); + var html = this.context.Html; + Assert.Throws(() => + { + SrkHtmlExtensions.SetTimezone(html, tzName); + }); } [Fact] public void GetterWorks1() { - var data = new ViewDataDictionary(); + var data = this.context.ViewData; var tzName = "Romance Standard Time"; var tz = TimeZoneInfo.FindSystemTimeZoneById(tzName); - var html = CreateHtmlHelper(data); + var html = this.context.Html; SrkHtmlExtensions.SetTimezone(html, tzName); var result = SrkHtmlExtensions.GetTimezone(html); @@ -150,10 +166,10 @@ public void GetterWorks1() [Fact] public void GetterWorks2() { - var data = new ViewDataDictionary(); + var data = this.context.ViewData; var tzName = "Russia Time Zone 3"; var tz = TimeZoneInfo.FindSystemTimeZoneById(tzName); - var html = CreateHtmlHelper(data); + var html = this.context.Html; SrkHtmlExtensions.SetTimezone(html, tzName); var result = SrkHtmlExtensions.GetTimezone(html); @@ -164,10 +180,10 @@ public void GetterWorks2() [Fact] public void WorksWhenSetInHttpContext1() { - var data = new ViewDataDictionary(); + var data = this.context.ViewData; var tzName = "Romance Standard Time"; var tz = TimeZoneInfo.FindSystemTimeZoneById(tzName); - var html = CreateHtmlHelper(data); + var html = this.context.Html; html.ViewContext.HttpContext.SetTimezone(tz); var result = SrkHtmlExtensions.GetTimezone(html); @@ -178,10 +194,10 @@ public void WorksWhenSetInHttpContext1() [Fact] public void WorksWhenSetInHttpContext2() { - var data = new ViewDataDictionary(); + var data = this.context.ViewData; var tzName = "Russia Time Zone 3"; var tz = TimeZoneInfo.FindSystemTimeZoneById(tzName); - var html = CreateHtmlHelper(data); + var html = this.context.Html; html.ViewContext.HttpContext.SetTimezone(tz); var result = SrkHtmlExtensions.GetTimezone(html); @@ -192,12 +208,19 @@ public void WorksWhenSetInHttpContext2() public class GetUserDateMethod { + private readonly AspNetCoreTestContext context; + + public GetUserDateMethod() + { + this.context = new AspNetCoreTestContext(); + } + [Fact] public void UndefinedTzIsUtc_ArgIsUtc_ResultIsUtc() { DateTime source = new DateTime(2013, 1, 29, 13, 28, 21, 1, DateTimeKind.Utc); TimeZoneInfo tz = null; - var html = CreateHtmlHelper(new ViewDataDictionary()); + var html = this.context.Html; html.SetTimezone(tz); DateTime utcResult; @@ -214,7 +237,7 @@ public void UndefinedTzIsUtc_ArgIsLocal_ResultIsUtc() DateTime source = orig.ToLocalTime(); Assert.Equal(DateTimeKind.Local, source.Kind); TimeZoneInfo tz = null; - var html = CreateHtmlHelper(new ViewDataDictionary()); + var html = this.context.Html; html.SetTimezone(tz); DateTime utcResult; @@ -231,7 +254,7 @@ public void UndefinedTzIsUtc_ArgIsUnspecified_ResultIsUtc() DateTime source = TimeZoneInfo.Utc.ConvertFromUtc(orig); Assert.Equal(DateTimeKind.Utc, source.Kind); TimeZoneInfo tz = null; - var html = CreateHtmlHelper(new ViewDataDictionary()); + var html = this.context.Html; html.SetTimezone(tz); DateTime utcResult; @@ -247,14 +270,14 @@ public void RomanceTz_ArgIsUtc_ResultIsRomance() TimeZoneInfo tz = TimeZoneInfo.FindSystemTimeZoneById("Romance Standard Time"); DateTime orig = new DateTime(2013, 1, 29, 13, 28, 21, 1, DateTimeKind.Utc); DateTime source = tz.ConvertFromUtc(orig); - var html = CreateHtmlHelper(new ViewDataDictionary()); + var html = this.context.Html; html.SetTimezone(tz); DateTime utcResult; var result = SrkHtmlExtensions.GetUserDate(html, source, out utcResult); - Assert.Equal(source, result, "wrong user result"); - Assert.Equal(orig, utcResult, "wrong UTC result"); + Assert.Equal(source, result); // wrong user result + Assert.Equal(orig, utcResult); // wrong UTC result } [Fact] @@ -265,14 +288,14 @@ public void RomanceTz_ArgIsLocal_ResultIsRomance() DateTime source = orig.ToLocalTime(); DateTime expected = tz.ConvertFromUtc(orig); Assert.Equal(DateTimeKind.Local, source.Kind); - var html = CreateHtmlHelper(new ViewDataDictionary()); + var html = this.context.Html; html.SetTimezone(tz); DateTime utcResult; var result = SrkHtmlExtensions.GetUserDate(html, source, out utcResult); - Assert.Equal(expected, result, "wrong user result"); - Assert.Equal(orig, utcResult, "wrong UTC result"); + Assert.Equal(expected, result); // wrong user result + Assert.Equal(orig, utcResult); // wrong UTC result } [Fact] @@ -282,19 +305,26 @@ public void RomanceTz_ArgIsUnspecified_ResultIsUtc() DateTime orig = new DateTime(2013, 1, 29, 13, 28, 21, 1, DateTimeKind.Utc); DateTime source = tz.ConvertFromUtc(orig); Assert.Equal(DateTimeKind.Unspecified, source.Kind); - var html = CreateHtmlHelper(new ViewDataDictionary()); + var html = this.context.Html; html.SetTimezone(tz); DateTime utcResult; var result = SrkHtmlExtensions.GetUserDate(html, source, out utcResult); - Assert.Equal(source, result, "wrong user result"); - Assert.Equal(orig, utcResult, "wrong UTC result"); + Assert.Equal(source, result); // wrong user result + Assert.Equal(orig, utcResult); // wrong UTC result } } public class DisplayDateMethod { + private readonly AspNetCoreTestContext context; + + public DisplayDateMethod() + { + this.context = new AspNetCoreTestContext(); + } + [Fact] public void UserIsUtc_ArgIsUtc_ResultIsUtc() { @@ -302,7 +332,7 @@ public void UserIsUtc_ArgIsUtc_ResultIsUtc() DateTime source = new DateTime(2013, 1, 29, 13, 28, 21, 1, DateTimeKind.Utc); TimeZoneInfo tz = null; string expected = ""; - var html = CreateHtmlHelper(new ViewDataDictionary()); + var html = this.context.Html; html.SetTimezone(tz); var result = SrkHtmlExtensions.DisplayDate(html, source); @@ -320,7 +350,7 @@ public void UserIsUtc_ArgIsLocal_ResultIsUtc() Debug.Assert(source.Kind == DateTimeKind.Local); TimeZoneInfo tz = null; string expected = ""; - var html = CreateHtmlHelper(new ViewDataDictionary()); + var html = this.context.Html; html.SetTimezone(tz); var result = SrkHtmlExtensions.DisplayDate(html, source); @@ -336,7 +366,7 @@ public void UserIsUtc_ArgIsUser_ResultIsUtc() Debug.Assert(source.Kind == DateTimeKind.Unspecified); TimeZoneInfo tz = null; string expected = ""; - var html = CreateHtmlHelper(new ViewDataDictionary()); + var html = this.context.Html; html.SetTimezone(tz); var result = SrkHtmlExtensions.DisplayDate(html, source); @@ -352,7 +382,7 @@ public void UserIsRomance_ArgIsUtc_ResultIsRomance() DateTime source = new DateTime(2013, 1, 29, 13, 28, 21, 1, DateTimeKind.Utc); DateTime romance = tz.ConvertFromUtc(source); string expected = ""; - var html = CreateHtmlHelper(new ViewDataDictionary()); + var html = this.context.Html; html.SetTimezone(tz); var result = SrkHtmlExtensions.DisplayDate(html, source); @@ -371,7 +401,7 @@ public void UserIsRomance_ArgIsLocal_ResultIsRomance() DateTime romance = tz.ConvertFromUtc(source); Debug.Assert(source.Kind == DateTimeKind.Local); string expected = ""; - var html = CreateHtmlHelper(new ViewDataDictionary()); + var html = this.context.Html; html.SetTimezone(tz); var result = SrkHtmlExtensions.DisplayDate(html, source); @@ -388,7 +418,7 @@ public void UserIsRomance_ArgIsUser_ResultIsRomance() DateTime utc = tz.ConvertToUtc(source); Debug.Assert(source.Kind == DateTimeKind.Unspecified); string expected = ""; - var html = CreateHtmlHelper(new ViewDataDictionary()); + var html = this.context.Html; html.SetTimezone(tz); var result = SrkHtmlExtensions.DisplayDate(html, source); @@ -399,6 +429,13 @@ public void UserIsRomance_ArgIsUser_ResultIsRomance() public class DisplayDateTimeMethod { + private readonly AspNetCoreTestContext context; + + public DisplayDateTimeMethod() + { + this.context = new AspNetCoreTestContext(); + } + [Fact] public void UserIsUtc_ArgIsUtc_ResultIsUtc() { @@ -406,7 +443,7 @@ public void UserIsUtc_ArgIsUtc_ResultIsUtc() DateTime source = new DateTime(2013, 1, 29, 13, 28, 21, 1, DateTimeKind.Utc); TimeZoneInfo tz = null; string expected = ""; - var html = CreateHtmlHelper(new ViewDataDictionary()); + var html = this.context.Html; html.SetTimezone(tz); var result = SrkHtmlExtensions.DisplayDateTime(html, source); @@ -424,7 +461,7 @@ public void UserIsUtc_ArgIsLocal_ResultIsUtc() Debug.Assert(source.Kind == DateTimeKind.Local); TimeZoneInfo tz = null; string expected = ""; - var html = CreateHtmlHelper(new ViewDataDictionary()); + var html = this.context.Html; html.SetTimezone(tz); var result = SrkHtmlExtensions.DisplayDateTime(html, source); @@ -440,7 +477,7 @@ public void UserIsUtc_ArgIsUser_ResultIsUtc() Debug.Assert(source.Kind == DateTimeKind.Unspecified); TimeZoneInfo tz = null; string expected = ""; - var html = CreateHtmlHelper(new ViewDataDictionary()); + var html = this.context.Html; html.SetTimezone(tz); var result = SrkHtmlExtensions.DisplayDateTime(html, source); @@ -456,7 +493,7 @@ public void UserIsRomance_ArgIsUtc_ResultIsRomance() DateTime source = new DateTime(2013, 1, 29, 13, 28, 21, 1, DateTimeKind.Utc); DateTime romance = tz.ConvertFromUtc(source); string expected = ""; - var html = CreateHtmlHelper(new ViewDataDictionary()); + var html = this.context.Html; html.SetTimezone(tz); var result = SrkHtmlExtensions.DisplayDateTime(html, source); @@ -475,7 +512,7 @@ public void UserIsRomance_ArgIsLocal_ResultIsRomance() DateTime romance = tz.ConvertFromUtc(source); Debug.Assert(source.Kind == DateTimeKind.Local); string expected = ""; - var html = CreateHtmlHelper(new ViewDataDictionary()); + var html = this.context.Html; html.SetTimezone(tz); var result = SrkHtmlExtensions.DisplayDateTime(html, source); @@ -492,7 +529,7 @@ public void UserIsRomance_ArgIsUser_ResultIsRomance() DateTime utc = tz.ConvertToUtc(source); Debug.Assert(source.Kind == DateTimeKind.Unspecified); string expected = ""; - var html = CreateHtmlHelper(new ViewDataDictionary()); + var html = this.context.Html; html.SetTimezone(tz); var result = SrkHtmlExtensions.DisplayDateTime(html, source); @@ -503,6 +540,13 @@ public void UserIsRomance_ArgIsUser_ResultIsRomance() public class DisplayTimeMethod { + private readonly AspNetCoreTestContext context; + + public DisplayTimeMethod() + { + this.context = new AspNetCoreTestContext(); + } + [Fact] public void UserIsUtc_ArgIsUtc_ResultIsUtc() { @@ -510,7 +554,7 @@ public void UserIsUtc_ArgIsUtc_ResultIsUtc() DateTime source = new DateTime(2013, 1, 29, 13, 28, 21, 1, DateTimeKind.Utc); TimeZoneInfo tz = null; string expected = ""; - var html = CreateHtmlHelper(new ViewDataDictionary()); + var html = this.context.Html; html.SetTimezone(tz); var result = SrkHtmlExtensions.DisplayTime(html, source); @@ -528,7 +572,7 @@ public void UserIsUtc_ArgIsLocal_ResultIsUtc() Debug.Assert(source.Kind == DateTimeKind.Local); TimeZoneInfo tz = null; string expected = ""; - var html = CreateHtmlHelper(new ViewDataDictionary()); + var html = this.context.Html; html.SetTimezone(tz); var result = SrkHtmlExtensions.DisplayTime(html, source); @@ -544,7 +588,7 @@ public void UserIsUtc_ArgIsUser_ResultIsUtc() Debug.Assert(source.Kind == DateTimeKind.Unspecified); TimeZoneInfo tz = null; string expected = ""; - var html = CreateHtmlHelper(new ViewDataDictionary()); + var html = this.context.Html; html.SetTimezone(tz); var result = SrkHtmlExtensions.DisplayTime(html, source); @@ -560,7 +604,7 @@ public void UserIsRomance_ArgIsUtc_ResultIsRomance() DateTime source = new DateTime(2013, 1, 29, 13, 28, 21, 1, DateTimeKind.Utc); DateTime romance = tz.ConvertFromUtc(source); string expected = ""; - var html = CreateHtmlHelper(new ViewDataDictionary()); + var html = this.context.Html; html.SetTimezone(tz); var result = SrkHtmlExtensions.DisplayTime(html, source); @@ -579,7 +623,7 @@ public void UserIsRomance_ArgIsLocal_ResultIsRomance() DateTime romance = tz.ConvertFromUtc(source); Debug.Assert(source.Kind == DateTimeKind.Local); string expected = ""; - var html = CreateHtmlHelper(new ViewDataDictionary()); + var html = this.context.Html; html.SetTimezone(tz); var result = SrkHtmlExtensions.DisplayTime(html, source); @@ -596,7 +640,7 @@ public void UserIsRomance_ArgIsUser_ResultIsRomance() DateTime utc = tz.ConvertToUtc(source); Debug.Assert(source.Kind == DateTimeKind.Unspecified); string expected = ""; - var html = CreateHtmlHelper(new ViewDataDictionary()); + var html = this.context.Html; html.SetTimezone(tz); var result = SrkHtmlExtensions.DisplayTime(html, source); @@ -609,6 +653,13 @@ public class JsDateMethod { private static readonly DateTime UnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); + private readonly AspNetCoreTestContext context; + + public JsDateMethod() + { + this.context = new AspNetCoreTestContext(); + } + [Fact] public void BackAndForth_UtcIn() { @@ -626,7 +677,7 @@ public void BackAndForth_UserTzIn() DateTime utc = UnixEpoch.AddMilliseconds(epoch); TimeZoneInfo tz = TimeZoneInfo.FindSystemTimeZoneById("Romance Standard Time"); DateTime user = tz.ConvertFromUtc(utc); - var html = CreateHtmlHelper(new ViewDataDictionary()); + var html = this.context.Html; html.SetTimezone(tz); var result = SrkHtmlExtensions.JsDate(html, user); var expected = "new Date(13912786171000)"; @@ -639,7 +690,7 @@ public void BackAndForth_LocalTzIn() long epoch = 13912786171000L; // GMT: Sat, 01 Feb 2014 18:16:57 GMT DateTime utc = UnixEpoch.AddMilliseconds(epoch); DateTime local = utc.ToLocalTime(); - var html = CreateHtmlHelper(new ViewDataDictionary()); + var html = this.context.Html; var result = SrkHtmlExtensions.JsDate(html, local); var expected = "new Date(13912786171000)"; Assert.Equal(expected, result.ToString()); @@ -654,23 +705,34 @@ public void BugWithSingleQuoteAndTwotter() var input = "J'ai ajouté une"; var expected = "J'ai ajouté une"; var result = SrkHtmlExtensions.DisplayText(null, input, twitterLinks: true, makeParagraphs: false); - SrkToolkit.Testing.Assert.Equal(expected, result.ToString()); + SrkToolkit.Testing.Assert.AreEqual(expected, result.ToString()); } } public class HasOtherValidationErrorsMethod { - [Fact, ExpectedException(typeof(ArgumentNullException))] + private readonly AspNetCoreTestContext context; + + public HasOtherValidationErrorsMethod() + { + this.context = new AspNetCoreTestContext(); + } + + [Fact] public void ThrowsWhenArg0IsNull() { - SrkHtmlExtensions.HasOtherValidationErrors(null); + Assert.Throws(() => + { + SrkHtmlExtensions.HasOtherValidationErrors(null); + }); } [Fact] public void ModelIsValid_ReturnsFalse() { var model = new TestModel { Name = "hello", }; - var html = GetHtmlHelper(model); + this.context.Model = model; + var html = this.context.Html; var result = SrkHtmlExtensions.HasOtherValidationErrors(html); @@ -681,7 +743,7 @@ public void ModelIsValid_ReturnsFalse() public void ModelIsPropertyInvalid_ReturnsFalse() { var model = new TestModel { Name = null, }; - var html = GetHtmlHelper(model); + var html = this.context.Html; var result = SrkHtmlExtensions.HasOtherValidationErrors(html); @@ -692,7 +754,7 @@ public void ModelIsPropertyInvalid_ReturnsFalse() public void ModelIsOtherInvalid_ReturnsFalse() { var model = new TestModel { Name = "hello", }; - var html = GetHtmlHelper(model); + var html = this.context.Html; html.ViewData.ModelState.AddModelError(string.Empty, "Other error"); var result = SrkHtmlExtensions.HasOtherValidationErrors(html); @@ -700,7 +762,7 @@ public void ModelIsOtherInvalid_ReturnsFalse() Assert.True(result); } } - +/* public class ValidationSummaryExMethod { [Fact] @@ -734,7 +796,7 @@ public void ModelIsValid_Hides() Assert.False(isDisplayed); } } - +*//* public class DescriptionForMethod { [Fact] @@ -798,9 +860,9 @@ private HtmlHelper GetHtmlHeper(TModel model) { var controllerContext = new ControllerContext(); var view = new Mock(); - var viewData = new ViewDataDictionary(); + var viewData = EmptyViewDataDictionary(); viewData.Model = model; - var tempData = new TempDataDictionary(); + var tempData = new TempDataDictionary(null, null); var writer = new StreamWriter(new MemoryStream()); var viewContext = new ViewContext(controllerContext, view.Object, viewData, tempData, writer); var viewDataContainer = new ViewPage(); @@ -808,7 +870,7 @@ private HtmlHelper GetHtmlHeper(TModel model) return html; } } - +*//* public class CallLinkMethod { [Fact] @@ -838,7 +900,7 @@ public void NationalUsaStandardFormat() Assert.Equal(expected, result.ToString()); } } - +*//* private static HtmlHelper GetHtmlHelper(TestModel model) { var http = new BasicHttpContext(); @@ -856,7 +918,19 @@ private static HtmlHelper GetHtmlHelper(TestModel model) var modelState = html.ViewData.ModelState; return html; } - +*/ + + public class SubmitMethod + { + [Fact] + public void Submit() + { + var context = new AspNetCoreTestContext(); + var result = context.Html.Submit("Go"); + Assert.Equal("", result.ToString()); + } + } + public class TestModel { [Required] @@ -870,5 +944,5 @@ public class TestModel public TestModel SubModel { get; set; } } - } -} + } +} diff --git a/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkHttpContextExtensionsTests.cs b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkHttpContextExtensionsTests.cs index 2d35709..e63e223 100644 --- a/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkHttpContextExtensionsTests.cs +++ b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkHttpContextExtensionsTests.cs @@ -26,11 +26,18 @@ public class SrkHttpContextExtensionsTests { public class SetTimezoneMethod { + private readonly AspNetCoreTestContext context; + + public SetTimezoneMethod() + { + this.context = new AspNetCoreTestContext(); + } + [Fact] public void WorksWithTzObject() { var tz = TimeZoneInfo.FindSystemTimeZoneById("Romance Standard Time"); - var http = new BasicHttpContext(); + var http = this.context.Context; SrkHttpContextExtensions.SetTimezone(http, tz); Assert.NotNull(http.Items["Timezone"]); @@ -42,35 +49,44 @@ public void WorksWithTzName() { var tzName = "Romance Standard Time"; var tz = TimeZoneInfo.FindSystemTimeZoneById(tzName); - var http = new BasicHttpContext(); + var http = this.context.Context; SrkHttpContextExtensions.SetTimezone(http, tzName); Assert.NotNull(http.Items["Timezone"]); Assert.Equal(tz, http.Items["Timezone"]); } - [Fact, ExpectedException(typeof(ArgumentException))] + [Fact] public void NullTzName() { string tzName = null; - var http = new BasicHttpContext(); - SrkHttpContextExtensions.SetTimezone(http, tzName); + var http = this.context.Context; + Assert.Throws(() => + { + SrkHttpContextExtensions.SetTimezone(http, tzName); + }); } - [Fact, ExpectedException(typeof(ArgumentException))] + [Fact] public void EmptyTzName() { string tzName = string.Empty; - var http = new BasicHttpContext(); - SrkHttpContextExtensions.SetTimezone(http, tzName); + var http = this.context.Context; + Assert.Throws(() => + { + SrkHttpContextExtensions.SetTimezone(http, tzName); + }); } - [Fact, ExpectedException(typeof(TimeZoneNotFoundException))] + [Fact] public void InvalidTzName() { string tzName = "Lunar Standard Time"; - var http = new BasicHttpContext(); - SrkHttpContextExtensions.SetTimezone(http, tzName); + var http = this.context.Context; + Assert.Throws(() => + { + SrkHttpContextExtensions.SetTimezone(http, tzName); + }); } [Fact] @@ -78,7 +94,7 @@ public void GetterWorks() { var tzName = "Romance Standard Time"; var tz = TimeZoneInfo.FindSystemTimeZoneById(tzName); - var http = new BasicHttpContext(); + var http = this.context.Context; SrkHttpContextExtensions.SetTimezone(http, tzName); var result = SrkHttpContextExtensions.GetTimezone(http); diff --git a/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkRequestExtensionsTests.cs b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkRequestExtensionsTests.cs index 4f08107..7797011 100644 --- a/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkRequestExtensionsTests.cs +++ b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkRequestExtensionsTests.cs @@ -16,6 +16,8 @@ namespace SrkToolkit.Web.Tests { + using Microsoft.AspNetCore.Http; + using SrkToolkit.AspNetCore; using SrkToolkit.Web.Fakes; using System; using System.Collections.Generic; @@ -23,32 +25,32 @@ namespace SrkToolkit.Web.Tests using System.Text; using Xunit; - public class SrkRequestExtensionsTests + public class SrkHttpRequestExtensionsTests { public class IsUrlLocalToHostMethod { [Fact] public void LocalNoSlash_IsNotLocal() { - HttpRequestBase request = null; + HttpRequest request = null; string url = "controller/action/id"; - Assert.False(SrkRequestExtensions.IsUrlLocalToHost(request, url)); + Assert.False(SrkHttpRequestExtensions.IsUrlLocalToHost(request, url)); } [Fact] public void LocalSlash_IsLocal() { - HttpRequestBase request = null; + HttpRequest request = null; string url = "/controller/action/id"; - Assert.True(SrkRequestExtensions.IsUrlLocalToHost(request, url)); + Assert.True(SrkHttpRequestExtensions.IsUrlLocalToHost(request, url)); } [Fact] public void WithProtocal_IsNotLocal() { - HttpRequestBase request = null; + HttpRequest request = null; string url = "http://test.com/controller/action/id"; - Assert.False(SrkRequestExtensions.IsUrlLocalToHost(request, url)); + Assert.False(SrkHttpRequestExtensions.IsUrlLocalToHost(request, url)); } } @@ -58,7 +60,7 @@ public class PrefersJsonMethod public void ArgNullThrows() { BasicHttpRequest request = null; - SrkRequestExtensions.PrefersJson(request); + SrkHttpRequestExtensions.PrefersJson(request); } [Fact] @@ -67,7 +69,7 @@ public void NullAcceptTypesReturnsFalse() string[] acceptTypes = null; var request = new BasicHttpRequest(); request.AcceptTypesCollection = acceptTypes; - Assert.False(SrkRequestExtensions.PrefersJson(request)); + Assert.False(SrkHttpRequestExtensions.PrefersJson(request)); } [Fact] @@ -76,7 +78,7 @@ public void EmptyAcceptTypesReturnsFalse() string[] acceptTypes = new string[0]; var request = new BasicHttpRequest(); request.AcceptTypesCollection = acceptTypes; - Assert.False(SrkRequestExtensions.PrefersJson(request)); + Assert.False(SrkHttpRequestExtensions.PrefersJson(request)); } [Fact] @@ -85,7 +87,7 @@ public void HtmlAcceptTypesReturnsFalse() string[] acceptTypes = new string[] { "text/html", "application/xhtml+xml", "application/xml", "*/*", }; var request = new BasicHttpRequest(); request.AcceptTypesCollection = acceptTypes; - Assert.False(SrkRequestExtensions.PrefersJson(request)); + Assert.False(SrkHttpRequestExtensions.PrefersJson(request)); } [Fact] @@ -94,7 +96,7 @@ public void JsonXmlAcceptTypesReturnsFalse() string[] acceptTypes = new string[] { "application/json", "application/xml", }; var request = new BasicHttpRequest(); request.AcceptTypesCollection = acceptTypes; - Assert.True(SrkRequestExtensions.PrefersJson(request)); + Assert.True(SrkHttpRequestExtensions.PrefersJson(request)); } [Fact] @@ -103,7 +105,7 @@ public void XmlJsonAcceptTypesReturnsFalse() string[] acceptTypes = new string[] { "application/xml", "application/json", }; var request = new BasicHttpRequest(); request.AcceptTypesCollection = acceptTypes; - Assert.False(SrkRequestExtensions.PrefersJson(request)); + Assert.False(SrkHttpRequestExtensions.PrefersJson(request)); } [Fact] @@ -112,7 +114,7 @@ public void TextJsonAcceptTypesReturnsFalse() string[] acceptTypes = new string[] { "text/json", "application/xml", }; var request = new BasicHttpRequest(); request.AcceptTypesCollection = acceptTypes; - Assert.True(SrkRequestExtensions.PrefersJson(request)); + Assert.True(SrkHttpRequestExtensions.PrefersJson(request)); } } } diff --git a/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkToolkit.AspNetCore2.UnitTests.csproj b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkToolkit.AspNetCore2.UnitTests.csproj index 37bdd87..3cb1586 100644 --- a/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkToolkit.AspNetCore2.UnitTests.csproj +++ b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkToolkit.AspNetCore2.UnitTests.csproj @@ -19,6 +19,7 @@ + @@ -42,14 +43,8 @@ - - - - - - diff --git a/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkUrlHelperExtensionsTests.cs b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkUrlHelperExtensionsTests.cs index 47468b4..2ec737e 100644 --- a/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkUrlHelperExtensionsTests.cs +++ b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkUrlHelperExtensionsTests.cs @@ -17,6 +17,7 @@ namespace SrkToolkit.Web.Tests { using Microsoft.AspNetCore.Http; + using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Routing; using Microsoft.AspNetCore.Routing; using System; @@ -24,13 +25,19 @@ namespace SrkToolkit.Web.Tests using System.IO; using System.Linq; using System.Text; - using System.Web.Mvc; using Xunit; public class SrkUrlHelperExtensionsTests { public class SetQueryStringMethod { + private readonly AspNetCoreTestContext context; + + public SetQueryStringMethod() + { + this.context = new AspNetCoreTestContext(); + } + [Fact] public void WithNoQuery() { @@ -96,7 +103,7 @@ public void WithOtherQueryKey() // verify Assert.Equal(expected, actual); } - +/* private static UrlHelper GetHelper(string path, string query) { var httpRequest = new HttpRequest("", "http://localhost/" + path, query); @@ -107,7 +114,7 @@ private static UrlHelper GetHelper(string path, string query) var helper = new UrlHelper(new RequestContext(wrapped, new RouteData())); return helper; } - +*/ [Fact] public void WithSameQueryKey() { @@ -244,10 +251,22 @@ public void BaseMultipleValues_ResetAndSetMultipleValues() // verify Assert.Equal(expected, actual); } + + private IUrlHelper GetHelper(string path, string empty) + { + return this.context.Url; + } } public class ResetQueryStringMethod { + private readonly AspNetCoreTestContext context; + + public ResetQueryStringMethod() + { + this.context = new AspNetCoreTestContext(); + } + [Fact] public void WithNoQuery() { @@ -313,7 +332,7 @@ public void WithOtherQueryKey() // verify Assert.Equal(expected, actual); } - +/* private static UrlHelper GetHelper(string path, string query) { var httpRequest = new HttpRequest("", "http://localhost/" + path, query); @@ -324,7 +343,7 @@ private static UrlHelper GetHelper(string path, string query) var helper = new UrlHelper(new RequestContext(wrapped, new RouteData())); return helper; } - +*/ [Fact] public void WithSameQueryKey() { @@ -461,6 +480,11 @@ public void BaseMultipleValues_ResetAndSetMultipleValues() // verify Assert.Equal(expected, actual); } + + private IUrlHelper GetHelper(string path, string empty) + { + return this.context.Url; + } } } } diff --git a/Sources/SrkToolkit.Web.AspNetCore2/Fakes/BasicHttpContext.cs b/Sources/SrkToolkit.Web.AspNetCore2/Fakes/BasicHttpContext.cs index 1aaebfa..d49ecd1 100644 --- a/Sources/SrkToolkit.Web.AspNetCore2/Fakes/BasicHttpContext.cs +++ b/Sources/SrkToolkit.Web.AspNetCore2/Fakes/BasicHttpContext.cs @@ -16,17 +16,17 @@ namespace SrkToolkit.Web.Fakes { + using Microsoft.AspNetCore.Http; using System; using System.Collections.Generic; using System.Linq; using System.Security.Principal; using System.Text; - using System.Web; /// /// Implementation of where the developer can set any property to any value. /// - public class BasicHttpContext : HttpContextBase + public class BasicHttpContext : HttpContext { private HttpSessionStateBase session; private IPrincipal user; diff --git a/Sources/SrkToolkit.Web.AspNetCore2/SrkTagBuilderExtensions.cs b/Sources/SrkToolkit.Web.AspNetCore2/SrkTagBuilderExtensions.cs index acf6a3e..eddb62f 100644 --- a/Sources/SrkToolkit.Web.AspNetCore2/SrkTagBuilderExtensions.cs +++ b/Sources/SrkToolkit.Web.AspNetCore2/SrkTagBuilderExtensions.cs @@ -22,6 +22,7 @@ namespace SrkToolkit.Web using System.Collections.Generic; using System.Linq; using System.Text; + using System.Text.Encodings.Web; /// /// Extension methods for the class. @@ -47,7 +48,9 @@ public static HtmlString ToHtmlString(this TagBuilder tag) throw new ArgumentNullException(nameof(tag)); } - return new HtmlString(tag.ToString()); + using var writer = new StringWriter(); + tag.WriteTo(writer, HtmlEncoder.Default); + return new HtmlString(writer.ToString()); } } } diff --git a/Sources/SrkToolkit.Web.AspNetCore2/SrkUrlHelperExtensions.cs b/Sources/SrkToolkit.Web.AspNetCore2/SrkUrlHelperExtensions.cs index 9465cb4..090cc21 100644 --- a/Sources/SrkToolkit.Web.AspNetCore2/SrkUrlHelperExtensions.cs +++ b/Sources/SrkToolkit.Web.AspNetCore2/SrkUrlHelperExtensions.cs @@ -16,6 +16,7 @@ namespace SrkToolkit.Web { + using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Routing; using System; using System.Collections.Generic; @@ -91,7 +92,6 @@ public static Uri ResetQueryString(this Uri uri, params string[] keysAndValues) return builder.Uri; } -#if !NSTD /// /// Replaces or adds values in the query string of the specified url. /// @@ -102,11 +102,10 @@ public static Uri ResetQueryString(this Uri uri, params string[] keysAndValues) /// the modified URL /// /// keysAndValues must be contain pairs of key and value;keysAndValues - public static string ResetQueryString(this UrlHelper helper, string url, params string[] keysAndValues) + public static string ResetQueryString(this IUrlHelper helper, string url, params string[] keysAndValues) { return SetQueryString(url, true, keysAndValues); } -#endif /// /// Replaces or adds values in the query string of the specified url. @@ -135,7 +134,6 @@ public static Uri SetQueryString(this Uri uri, params string[] keysAndValues) return builder.Uri; } -#if !NSTD /// /// Replaces or adds values in the query string of the specified url. /// @@ -146,11 +144,10 @@ public static Uri SetQueryString(this Uri uri, params string[] keysAndValues) /// the modified URL /// /// keysAndValues must be contain pairs of key and value;keysAndValues - public static string SetQueryString(this UrlHelper helper, string url, params string[] keysAndValues) + public static string SetQueryString(this IUrlHelper helper, string url, params string[] keysAndValues) { return SetQueryString(url, keysAndValues); } -#endif /// /// Replaces or adds values in the query string of the specified url. From 8c2ceea06b39e12cb0487776aa4b44bb2aaad01e Mon Sep 17 00:00:00 2001 From: SandRock Date: Mon, 27 Mar 2023 18:08:38 +0200 Subject: [PATCH 20/34] SrkToolkit.AspNetCore2: migrate HttpRequest extensions --- .../SrkRequestExtensionsTests.cs | 62 ++++++---- .../SrkToolkit.AspNetCore2.UnitTests.csproj | 2 - .../SrkRequestExtensions.cs | 109 ++---------------- .../SrkToolkit.Web.AspNetCore2.csproj | 2 + 4 files changed, 49 insertions(+), 126 deletions(-) rename Sources/{SrkToolkit.Web.AspMvc5 => SrkToolkit.Web.AspNetCore2}/SrkRequestExtensions.cs (51%) diff --git a/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkRequestExtensionsTests.cs b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkRequestExtensionsTests.cs index 7797011..bc14862 100644 --- a/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkRequestExtensionsTests.cs +++ b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkRequestExtensionsTests.cs @@ -17,7 +17,7 @@ namespace SrkToolkit.Web.Tests { using Microsoft.AspNetCore.Http; - using SrkToolkit.AspNetCore; + using Microsoft.AspNetCore.Http.Internal; using SrkToolkit.Web.Fakes; using System; using System.Collections.Generic; @@ -34,7 +34,7 @@ public void LocalNoSlash_IsNotLocal() { HttpRequest request = null; string url = "controller/action/id"; - Assert.False(SrkHttpRequestExtensions.IsUrlLocalToHost(request, url)); + Assert.False(request.IsUrlLocalToHost(url)); } [Fact] @@ -42,7 +42,7 @@ public void LocalSlash_IsLocal() { HttpRequest request = null; string url = "/controller/action/id"; - Assert.True(SrkHttpRequestExtensions.IsUrlLocalToHost(request, url)); + Assert.True(request.IsUrlLocalToHost(url)); } [Fact] @@ -50,71 +50,83 @@ public void WithProtocal_IsNotLocal() { HttpRequest request = null; string url = "http://test.com/controller/action/id"; - Assert.False(SrkHttpRequestExtensions.IsUrlLocalToHost(request, url)); + Assert.False(request.IsUrlLocalToHost(url)); } } public class PrefersJsonMethod { - [Fact, ExpectedException(typeof(ArgumentNullException))] + private readonly AspNetCoreTestContext context; + + public PrefersJsonMethod() + { + this.context = new AspNetCoreTestContext(); + } + + [Fact] public void ArgNullThrows() { - BasicHttpRequest request = null; - SrkHttpRequestExtensions.PrefersJson(request); + HttpRequest request = null; + Assert.Throws(() => + { + request.PrefersJson(); + }); } [Fact] public void NullAcceptTypesReturnsFalse() { string[] acceptTypes = null; - var request = new BasicHttpRequest(); - request.AcceptTypesCollection = acceptTypes; - Assert.False(SrkHttpRequestExtensions.PrefersJson(request)); + var request = new DefaultHttpRequest(this.context.Context); + ////request.Headers["Accept"] = null; + ////request.AcceptTypesCollection = acceptTypes; + Assert.False(request.PrefersJson()); } [Fact] public void EmptyAcceptTypesReturnsFalse() { string[] acceptTypes = new string[0]; - var request = new BasicHttpRequest(); - request.AcceptTypesCollection = acceptTypes; - Assert.False(SrkHttpRequestExtensions.PrefersJson(request)); + var request = new DefaultHttpRequest(this.context.Context); + request.Headers["Accept"] = acceptTypes; + Assert.False(request.PrefersJson()); } [Fact] public void HtmlAcceptTypesReturnsFalse() { string[] acceptTypes = new string[] { "text/html", "application/xhtml+xml", "application/xml", "*/*", }; - var request = new BasicHttpRequest(); - request.AcceptTypesCollection = acceptTypes; - Assert.False(SrkHttpRequestExtensions.PrefersJson(request)); + + var request = new DefaultHttpRequest(this.context.Context); + request.Headers["Accept"] = acceptTypes; + Assert.False(request.PrefersJson()); } [Fact] public void JsonXmlAcceptTypesReturnsFalse() { string[] acceptTypes = new string[] { "application/json", "application/xml", }; - var request = new BasicHttpRequest(); - request.AcceptTypesCollection = acceptTypes; - Assert.True(SrkHttpRequestExtensions.PrefersJson(request)); + var request = new DefaultHttpRequest(this.context.Context); + request.Headers["Accept"] = acceptTypes; + Assert.True(request.PrefersJson()); } [Fact] public void XmlJsonAcceptTypesReturnsFalse() { string[] acceptTypes = new string[] { "application/xml", "application/json", }; - var request = new BasicHttpRequest(); - request.AcceptTypesCollection = acceptTypes; - Assert.False(SrkHttpRequestExtensions.PrefersJson(request)); + var request = new DefaultHttpRequest(this.context.Context); + request.Headers["Accept"] = acceptTypes; + Assert.False(request.PrefersJson()); } [Fact] public void TextJsonAcceptTypesReturnsFalse() { string[] acceptTypes = new string[] { "text/json", "application/xml", }; - var request = new BasicHttpRequest(); - request.AcceptTypesCollection = acceptTypes; - Assert.True(SrkHttpRequestExtensions.PrefersJson(request)); + var request = new DefaultHttpRequest(this.context.Context); + request.Headers["Accept"] = acceptTypes; + Assert.True(request.PrefersJson()); } } } diff --git a/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkToolkit.AspNetCore2.UnitTests.csproj b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkToolkit.AspNetCore2.UnitTests.csproj index 3cb1586..6dd9687 100644 --- a/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkToolkit.AspNetCore2.UnitTests.csproj +++ b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkToolkit.AspNetCore2.UnitTests.csproj @@ -43,8 +43,6 @@ - - diff --git a/Sources/SrkToolkit.Web.AspMvc5/SrkRequestExtensions.cs b/Sources/SrkToolkit.Web.AspNetCore2/SrkRequestExtensions.cs similarity index 51% rename from Sources/SrkToolkit.Web.AspMvc5/SrkRequestExtensions.cs rename to Sources/SrkToolkit.Web.AspNetCore2/SrkRequestExtensions.cs index 957eda9..935c17c 100644 --- a/Sources/SrkToolkit.Web.AspMvc5/SrkRequestExtensions.cs +++ b/Sources/SrkToolkit.Web.AspNetCore2/SrkRequestExtensions.cs @@ -16,14 +16,16 @@ namespace SrkToolkit.Web { + using Microsoft.AspNetCore.Http; using System; using System.Collections.Generic; + using System.Globalization; using System.Linq; using System.Text; using System.Web; /// - /// Extension methods for the and classes. + /// Extension methods for the classes. /// public static class SrkRequestExtensions { @@ -46,23 +48,7 @@ public static bool IsXmlHttpRequest(this HttpRequest request) if (string.IsNullOrEmpty(header)) return false; - return xhrValues.Contains(header.ToUpperInvariant()); - } - - /// - /// Determines whether the specified request is made via AJAX. - /// - /// The request. - /// - /// true if [is XML HTTP request] [the specified request]; otherwise, false. - /// - public static bool IsXmlHttpRequest(this HttpRequestBase request) - { - var header = request.Headers["X-Requested-With"]; - if (string.IsNullOrEmpty(header)) - return false; - - return xhrValues.Contains(header.ToUpperInvariant()); + return xhrValues.Any(searchValue => header.Any(value => value.Equals(searchValue, StringComparison.OrdinalIgnoreCase))); } /// @@ -72,17 +58,7 @@ public static bool IsXmlHttpRequest(this HttpRequestBase request) /// public static bool IsHttpGetRequest(this HttpRequest request) { - return "GET".Equals(request.HttpMethod, StringComparison.OrdinalIgnoreCase); - } - - /// - /// Determines whether the HTTP method is GET. - /// - /// The request. - /// - public static bool IsHttpGetRequest(this HttpRequestBase request) - { - return "GET".Equals(request.HttpMethod, StringComparison.OrdinalIgnoreCase); + return "GET".Equals(request.Method, StringComparison.OrdinalIgnoreCase); } /// @@ -92,17 +68,7 @@ public static bool IsHttpGetRequest(this HttpRequestBase request) /// public static bool IsHttpPostRequest(this HttpRequest request) { - return "POST".Equals(request.HttpMethod, StringComparison.OrdinalIgnoreCase); - } - - /// - /// Determines whether the HTTP method is POST. - /// - /// The request. - /// - public static bool IsHttpPostRequest(this HttpRequestBase request) - { - return "POST".Equals(request.HttpMethod, StringComparison.OrdinalIgnoreCase); + return "POST".Equals(request.Method, StringComparison.OrdinalIgnoreCase); } /// @@ -112,17 +78,7 @@ public static bool IsHttpPostRequest(this HttpRequestBase request) /// public static bool IsHttpDeleteRequest(this HttpRequest request) { - return "DELETE".Equals(request.HttpMethod, StringComparison.OrdinalIgnoreCase); - } - - /// - /// Determines whether is HTTP method is DELETE. - /// - /// The request. - /// - public static bool IsHttpDeleteRequest(this HttpRequestBase request) - { - return "DELETE".Equals(request.HttpMethod, StringComparison.OrdinalIgnoreCase); + return "DELETE".Equals(request.Method, StringComparison.OrdinalIgnoreCase); } /// @@ -132,17 +88,7 @@ public static bool IsHttpDeleteRequest(this HttpRequestBase request) /// public static bool IsHttpPutRequest(this HttpRequest request) { - return "PUT".Equals(request.HttpMethod, StringComparison.OrdinalIgnoreCase); - } - - /// - /// Determines whether is HTTP method is PUT. - /// - /// The request. - /// - public static bool IsHttpPutRequest(this HttpRequestBase request) - { - return "PUT".Equals(request.HttpMethod, StringComparison.OrdinalIgnoreCase); + return "PUT".Equals(request.Method, StringComparison.OrdinalIgnoreCase); } /// @@ -152,28 +98,7 @@ public static bool IsHttpPutRequest(this HttpRequestBase request) /// public static bool IsHttpHeadRequest(this HttpRequest request) { - return "HEAD".Equals(request.HttpMethod, StringComparison.OrdinalIgnoreCase); - } - - /// - /// Determines whether is HTTP method is HEAD. - /// - /// The request. - /// - public static bool IsHttpHeadRequest(this HttpRequestBase request) - { - return "HEAD".Equals(request.HttpMethod, StringComparison.OrdinalIgnoreCase); - } - - /// - /// Determines whether the specified URL is local to the request's host. - /// - /// The request. - /// The URL. - /// - public static bool IsUrlLocalToHost(this HttpRequestBase request, string url) - { - return IsUrlLocalToHost(url); + return "HEAD".Equals(request.Method, StringComparison.OrdinalIgnoreCase); } /// @@ -208,21 +133,7 @@ public static bool PrefersJson(this HttpRequest request) if (request == null) throw new ArgumentNullException("request"); - return PrefersJson(request.AcceptTypes); - } - - /// - /// Determines whether the client prefers a JSON response. - /// - /// The request. - /// true if the first accept type is JSON; otherwise, false - /// request - public static bool PrefersJson(this HttpRequestBase request) - { - if (request == null) - throw new ArgumentNullException("request"); - - return PrefersJson(request.AcceptTypes); + return PrefersJson(request.Headers["Accept"]); } private static bool PrefersJson(string[] acceptTypes) diff --git a/Sources/SrkToolkit.Web.AspNetCore2/SrkToolkit.Web.AspNetCore2.csproj b/Sources/SrkToolkit.Web.AspNetCore2/SrkToolkit.Web.AspNetCore2.csproj index 4466e67..861deb5 100644 --- a/Sources/SrkToolkit.Web.AspNetCore2/SrkToolkit.Web.AspNetCore2.csproj +++ b/Sources/SrkToolkit.Web.AspNetCore2/SrkToolkit.Web.AspNetCore2.csproj @@ -37,6 +37,8 @@ SrkToolkit.snk + + From 2499cef86bd81e9bcee0711770da76c0e105a319 Mon Sep 17 00:00:00 2001 From: SandRock Date: Tue, 28 Mar 2023 18:09:40 +0200 Subject: [PATCH 21/34] SrkToolkit.Domain.AspNetCore2: migrate temptada messages --- .../AspNetCoreTestContext.cs | 13 ++++- .../SrkTempDataDictionaryExtensionsTests.cs | 48 +++++++++++++++++++ .../SrkRequestExtensions.cs | 3 +- .../SrkTempDataDictionaryExtensions.cs | 12 ++--- 4 files changed, 67 insertions(+), 9 deletions(-) create mode 100644 Sources/SrkToolkit.AspNetCore2.UnitTests/SrkTempDataDictionaryExtensionsTests.cs diff --git a/Sources/SrkToolkit.AspNetCore2.UnitTests/AspNetCoreTestContext.cs b/Sources/SrkToolkit.AspNetCore2.UnitTests/AspNetCoreTestContext.cs index 9e1d3f3..1840dbd 100644 --- a/Sources/SrkToolkit.AspNetCore2.UnitTests/AspNetCoreTestContext.cs +++ b/Sources/SrkToolkit.AspNetCore2.UnitTests/AspNetCoreTestContext.cs @@ -37,6 +37,7 @@ public class AspNetCoreTestContext private ActionContext action; private RouteData routeData; private TempDataDictionary tempData; + private ITempDataProvider tempDataProvider; /// /// Helps generate a HttpContext and all the ASP and MVC objects in order to do component testing. @@ -158,7 +159,7 @@ public virtual IHtmlHelper Html this.ActionContext, new NullView(), this.ViewData, - this.tempData ?? (this.tempData = new TempDataDictionary(this.Context, new Mock().Object)), + this.tempData ?? (this.tempData = new TempDataDictionary(this.Context, this.TempDataProvider)), new StringWriter(), new HtmlHelperOptions()); this.html.Contextualize(viewContext); @@ -183,6 +184,16 @@ public IUrlHelper Url return this.url; } } + + public ITempDataDictionary TempData + { + get { return this.tempData ?? (this.tempData = new TempDataDictionary(this.Context, this.TempDataProvider)); } + } + + internal ITempDataProvider TempDataProvider + { + get { return this.tempDataProvider ?? (this.tempDataProvider = new Mock().Object); } + } } /// diff --git a/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkTempDataDictionaryExtensionsTests.cs b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkTempDataDictionaryExtensionsTests.cs new file mode 100644 index 0000000..d495dfb --- /dev/null +++ b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkTempDataDictionaryExtensionsTests.cs @@ -0,0 +1,48 @@ + +namespace SrkToolkit.Web.Tests; + +using System; +using Xunit; + +public class SrkTempDataDictionaryExtensionsTests +{ + [Fact] + public void AddError_Works() + { + var context = new AspNetCoreTestContext(); + context.TempData.AddError("ErrorMessage"); + + var messages = context.TempData.GetAll(); + Assert.Single(messages); + } + + [Fact] + public void AddConfirmation_Works() + { + var context = new AspNetCoreTestContext(); + context.TempData.AddConfirmation("Message"); + + var messages = context.TempData.GetAll(); + Assert.Single(messages); + } + + [Fact] + public void AddInfo_Works() + { + var context = new AspNetCoreTestContext(); + context.TempData.AddInfo("Message"); + + var messages = context.TempData.GetAll(); + Assert.Single(messages); + } + + [Fact] + public void AddWarning_Works() + { + var context = new AspNetCoreTestContext(); + context.TempData.AddWarning("Message"); + + var messages = context.TempData.GetAll(); + Assert.Single(messages); + } +} diff --git a/Sources/SrkToolkit.Web.AspNetCore2/SrkRequestExtensions.cs b/Sources/SrkToolkit.Web.AspNetCore2/SrkRequestExtensions.cs index 935c17c..0d86b3d 100644 --- a/Sources/SrkToolkit.Web.AspNetCore2/SrkRequestExtensions.cs +++ b/Sources/SrkToolkit.Web.AspNetCore2/SrkRequestExtensions.cs @@ -22,7 +22,6 @@ namespace SrkToolkit.Web using System.Globalization; using System.Linq; using System.Text; - using System.Web; /// /// Extension methods for the classes. @@ -48,7 +47,7 @@ public static bool IsXmlHttpRequest(this HttpRequest request) if (string.IsNullOrEmpty(header)) return false; - return xhrValues.Any(searchValue => header.Any(value => value.Equals(searchValue, StringComparison.OrdinalIgnoreCase))); + return xhrValues.Any(searchValue => header.Any(value => value.Equals(searchValue, StringComparison.OrdinalIgnoreCase))); } /// diff --git a/Sources/SrkToolkit.Web.AspNetCore2/SrkTempDataDictionaryExtensions.cs b/Sources/SrkToolkit.Web.AspNetCore2/SrkTempDataDictionaryExtensions.cs index 80aba8f..340f196 100644 --- a/Sources/SrkToolkit.Web.AspNetCore2/SrkTempDataDictionaryExtensions.cs +++ b/Sources/SrkToolkit.Web.AspNetCore2/SrkTempDataDictionaryExtensions.cs @@ -31,7 +31,7 @@ public static class SrkTempDataDictionaryExtensions /// The temp data. /// The error message. /// indicates the message contains HTML markup - public static void AddError(this TempDataDictionary tempData, string errorMessage, bool isMarkup = false) + public static void AddError(this ITempDataDictionary tempData, string errorMessage, bool isMarkup = false) { var message = new TempMessage(TempMessageKind.Error, errorMessage, isMarkup); @@ -44,7 +44,7 @@ public static void AddError(this TempDataDictionary tempData, string errorMessag /// The temp data. /// The warning message. /// indicates the message contains HTML markup - public static void AddWarning(this TempDataDictionary tempData, string warningMessage, bool isMarkup = false) + public static void AddWarning(this ITempDataDictionary tempData, string warningMessage, bool isMarkup = false) { var message = new TempMessage(TempMessageKind.Warning, warningMessage, isMarkup); @@ -57,7 +57,7 @@ public static void AddWarning(this TempDataDictionary tempData, string warningMe /// The temp data. /// The info message. /// indicates the message contains HTML markup - public static void AddInfo(this TempDataDictionary tempData, string infoMessage, bool isMarkup = false) + public static void AddInfo(this ITempDataDictionary tempData, string infoMessage, bool isMarkup = false) { var message = new TempMessage(TempMessageKind.Information, infoMessage, isMarkup); @@ -70,7 +70,7 @@ public static void AddInfo(this TempDataDictionary tempData, string infoMessage, /// The temp data. /// The info message. /// indicates the message contains HTML markup - public static void AddConfirmation(this TempDataDictionary tempData, string message, bool isMarkup = false) + public static void AddConfirmation(this ITempDataDictionary tempData, string message, bool isMarkup = false) { var msg = new TempMessage(TempMessageKind.Confirmation, message, isMarkup); @@ -82,7 +82,7 @@ public static void AddConfirmation(this TempDataDictionary tempData, string mess /// /// The temp data. /// - public static IList GetAll(this TempDataDictionary tempData) + public static IList GetAll(this ITempDataDictionary tempData) { var list = new List(); @@ -96,7 +96,7 @@ public static IList GetAll(this TempDataDictionary tempData) return list; } - private static void AddMessage(TempDataDictionary tempData, TempMessage message) + private static void AddMessage(ITempDataDictionary tempData, TempMessage message) { IList list = null; From d69a6fc6dcb510d911126bc238c80d92f92c8152 Mon Sep 17 00:00:00 2001 From: SandRock Date: Tue, 28 Mar 2023 19:02:15 +0200 Subject: [PATCH 22/34] SrkToolkit.Domain.AspNetCore2: migrate controller.ValidateResult (WIP) --- .../AspNetCoreTestContext.cs | 6 +++ .../SrkDomainControllerExtensionsTests.cs | 51 +++++++++++++++++++ .../SrkToolkit.AspNetCore2.UnitTests.csproj | 1 + .../SrkToolkit.Domain.AspNetCore2.csproj | 14 ++--- 4 files changed, 62 insertions(+), 10 deletions(-) create mode 100644 Sources/SrkToolkit.AspNetCore2.UnitTests/SrkDomainControllerExtensionsTests.cs diff --git a/Sources/SrkToolkit.AspNetCore2.UnitTests/AspNetCoreTestContext.cs b/Sources/SrkToolkit.AspNetCore2.UnitTests/AspNetCoreTestContext.cs index 1840dbd..2d4eed1 100644 --- a/Sources/SrkToolkit.AspNetCore2.UnitTests/AspNetCoreTestContext.cs +++ b/Sources/SrkToolkit.AspNetCore2.UnitTests/AspNetCoreTestContext.cs @@ -190,6 +190,12 @@ public ITempDataDictionary TempData get { return this.tempData ?? (this.tempData = new TempDataDictionary(this.Context, this.TempDataProvider)); } } + public ControllerContext CreateControllerContext() + { + var item = new ControllerContext(this.ActionContext); + return item; + } + internal ITempDataProvider TempDataProvider { get { return this.tempDataProvider ?? (this.tempDataProvider = new Mock().Object); } diff --git a/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkDomainControllerExtensionsTests.cs b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkDomainControllerExtensionsTests.cs new file mode 100644 index 0000000..8b31357 --- /dev/null +++ b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkDomainControllerExtensionsTests.cs @@ -0,0 +1,51 @@ + +namespace SrkToolkit.Web.Tests; + +using Microsoft.AspNetCore.Mvc; +using SrkToolkit.Domain; +using System; +using Xunit; + +public class SrkDomainControllerExtensionsTests +{ + [Fact] + public void ValidResult_TempData_Works() + { + var context = new AspNetCoreTestContext(); + var controller = new MyController(); + controller.ControllerContext = context.CreateControllerContext(); + var result = new BasicResult(); + result.Succeed = true; + var isValid = controller.ValidateResult(result, MessageDisplayMode.TempData); + Assert.True(isValid); + Assert.Empty(context.TempData); + } + + [Fact] + public void InvalidResult_TempData_Works() + { + var context = new AspNetCoreTestContext(); + var controller = new MyController(); + controller.ControllerContext = context.CreateControllerContext(); + var result = new BasicResult(); + result.Errors.Add(ErrorCode.Unauthorized); + result.Succeed = result.Errors.Count == 0; + var isValid = controller.ValidateResult(result, MessageDisplayMode.TempData); + Assert.False(isValid); + Assert.Single(context.TempData); + } + + class MyController : Controller + { + public ActionResult MyAction() + { + return this.NoContent(); + } + } + + enum ErrorCode + { + Invalid, + Unauthorized, + } +} diff --git a/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkToolkit.AspNetCore2.UnitTests.csproj b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkToolkit.AspNetCore2.UnitTests.csproj index 6dd9687..fd0710a 100644 --- a/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkToolkit.AspNetCore2.UnitTests.csproj +++ b/Sources/SrkToolkit.AspNetCore2.UnitTests/SrkToolkit.AspNetCore2.UnitTests.csproj @@ -35,6 +35,7 @@ + diff --git a/Sources/SrkToolkit.Domain.AspNetCore2/SrkToolkit.Domain.AspNetCore2.csproj b/Sources/SrkToolkit.Domain.AspNetCore2/SrkToolkit.Domain.AspNetCore2.csproj index 1d6acd6..ed7d4bf 100644 --- a/Sources/SrkToolkit.Domain.AspNetCore2/SrkToolkit.Domain.AspNetCore2.csproj +++ b/Sources/SrkToolkit.Domain.AspNetCore2/SrkToolkit.Domain.AspNetCore2.csproj @@ -29,8 +29,6 @@ SrkToolkit.snk - - @@ -44,16 +42,12 @@ - <_ProjectReferenceWithExplicitPackageVersion Include="@(ProjectReference->'%(FullPath)')" - Condition="'%(ProjectReference.PackageVersion)' != ''" /> - <_ProjectReferenceWithExactPackageVersion Include="@(ProjectReference->'%(FullPath)')" - Condition="'%(ProjectReference.ExactVersion)' == 'true'" /> - <_ProjectReferenceWithReassignedVersion Include="@(_ProjectReferencesWithVersions)" - Condition="'%(Identity)' != '' And '@(_ProjectReferencesWithVersions)' == '@(_ProjectReferenceWithExplicitPackageVersion)'"> + <_ProjectReferenceWithExplicitPackageVersion Include="@(ProjectReference->'%(FullPath)')" Condition="'%(ProjectReference.PackageVersion)' != ''" /> + <_ProjectReferenceWithExactPackageVersion Include="@(ProjectReference->'%(FullPath)')" Condition="'%(ProjectReference.ExactVersion)' == 'true'" /> + <_ProjectReferenceWithReassignedVersion Include="@(_ProjectReferencesWithVersions)" Condition="'%(Identity)' != '' And '@(_ProjectReferencesWithVersions)' == '@(_ProjectReferenceWithExplicitPackageVersion)'"> @(_ProjectReferenceWithExplicitPackageVersion->'%(PackageVersion)') - <_ProjectReferenceWithReassignedVersion Include="@(_ProjectReferencesWithVersions)" - Condition="'%(Identity)' != '' And '@(_ProjectReferencesWithVersions)' == '@(_ProjectReferenceWithExactPackageVersion)'"> + <_ProjectReferenceWithReassignedVersion Include="@(_ProjectReferencesWithVersions)" Condition="'%(Identity)' != '' And '@(_ProjectReferencesWithVersions)' == '@(_ProjectReferenceWithExactPackageVersion)'"> [@(_ProjectReferencesWithVersions->'%(ProjectVersion)')] <_ProjectReferencesWithVersions Remove="@(_ProjectReferenceWithReassignedVersion)" /> From 1df9cc4b1051829b49c540bef156c3c6636facab Mon Sep 17 00:00:00 2001 From: SandRock Date: Mon, 3 Apr 2023 19:01:16 +0200 Subject: [PATCH 23/34] nuget: include a readme file --- Sources/SrkToolkit.Common/SrkToolkit.Common.csproj | 10 +++++++++- .../SrkToolkit.Domain.AspNetCore2.csproj | 10 +++++++++- Sources/SrkToolkit.Domain/SrkToolkit.Domain.csproj | 10 +++++++++- .../SrkToolkit.Web.AspNetCore2.csproj | 10 +++++++++- 4 files changed, 36 insertions(+), 4 deletions(-) diff --git a/Sources/SrkToolkit.Common/SrkToolkit.Common.csproj b/Sources/SrkToolkit.Common/SrkToolkit.Common.csproj index adb5738..6b9b581 100644 --- a/Sources/SrkToolkit.Common/SrkToolkit.Common.csproj +++ b/Sources/SrkToolkit.Common/SrkToolkit.Common.csproj @@ -6,7 +6,7 @@ net40;net7.0;netstandard2.0 9 true - 2.0.146-preview1 + 2.0.147-preview2 SandRock, pyDez Apache-2.0 SrkToolkit.Common contains various extension methods, validators and utility classes. @@ -19,6 +19,7 @@ ..\SrkToolkit.snk SrkToolkit logo-200.png + SrkToolkit.Common.md @@ -51,4 +52,11 @@ + + + + SrkToolkit.Common.md + + + diff --git a/Sources/SrkToolkit.Domain.AspNetCore2/SrkToolkit.Domain.AspNetCore2.csproj b/Sources/SrkToolkit.Domain.AspNetCore2/SrkToolkit.Domain.AspNetCore2.csproj index ed7d4bf..e8d61d5 100644 --- a/Sources/SrkToolkit.Domain.AspNetCore2/SrkToolkit.Domain.AspNetCore2.csproj +++ b/Sources/SrkToolkit.Domain.AspNetCore2/SrkToolkit.Domain.AspNetCore2.csproj @@ -6,7 +6,7 @@ enable SrkToolkit.Domain.AspNetCore2 true - 2.0.146-preview1 + 2.0.147-preview2 SandRock Apache-2.0 SrkToolkit.Domain.AspNetCore2 contains extension methods for SrkToolkit.Domain in the context of a ASP MVC Core application. @@ -18,6 +18,7 @@ 2.0.0.0 true ..\SrkToolkit.snk + SrkToolkit.Domain.md @@ -40,6 +41,13 @@ + + + + SrkToolkit.Domain.md + + + <_ProjectReferenceWithExplicitPackageVersion Include="@(ProjectReference->'%(FullPath)')" Condition="'%(ProjectReference.PackageVersion)' != ''" /> diff --git a/Sources/SrkToolkit.Domain/SrkToolkit.Domain.csproj b/Sources/SrkToolkit.Domain/SrkToolkit.Domain.csproj index 2ff4af6..d5ced03 100644 --- a/Sources/SrkToolkit.Domain/SrkToolkit.Domain.csproj +++ b/Sources/SrkToolkit.Domain/SrkToolkit.Domain.csproj @@ -6,7 +6,7 @@ net46;net7.0;netstandard2.0 9 true - 2.0.146-preview1 + 2.0.147-preview2 SandRock Apache-2.0 SrkToolkit.Domain is used in your domain layer to provider RPC-style request and result classes. @@ -18,6 +18,7 @@ 2.0.0.0 true ..\SrkToolkit.snk + SrkToolkit.Domain.md @@ -44,5 +45,12 @@ Internals\EnumTools.cs + + + + + SrkToolkit.Domain.md + + diff --git a/Sources/SrkToolkit.Web.AspNetCore2/SrkToolkit.Web.AspNetCore2.csproj b/Sources/SrkToolkit.Web.AspNetCore2/SrkToolkit.Web.AspNetCore2.csproj index 861deb5..b9a2fa4 100644 --- a/Sources/SrkToolkit.Web.AspNetCore2/SrkToolkit.Web.AspNetCore2.csproj +++ b/Sources/SrkToolkit.Web.AspNetCore2/SrkToolkit.Web.AspNetCore2.csproj @@ -6,7 +6,7 @@ default SrkToolkit.Web true - 2.0.146-preview1 + 2.0.147-preview2 SandRock Apache-2.0 SrkToolkit.Web.AspNetCore2 is a bunch of extensions and components to use with your ASP MVC Core project. @@ -18,6 +18,7 @@ 2.0.0.0 true ..\SrkToolkit.snk + SrkToolkit.Web.md @@ -127,6 +128,13 @@ + + + + SrkToolkit.Web.md + + + <_ProjectReferenceWithExplicitPackageVersion Include="@(ProjectReference->'%(FullPath)')" Condition="'%(ProjectReference.PackageVersion)' != ''" /> From a48e9d6f691e1fdb1784ea21e038cd5a63677f80 Mon Sep 17 00:00:00 2001 From: SandRock Date: Mon, 3 Apr 2023 19:18:46 +0200 Subject: [PATCH 24/34] notes on releasing --- Releasing.md | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/Releasing.md b/Releasing.md index 7519d0e..60ced7d 100644 --- a/Releasing.md +++ b/Releasing.md @@ -1,21 +1,18 @@ - -Evaluate next version identifier by running the build app - -```batch -cd Tools -.\build.bat -``` - -Update the `SrkToolkit.Mvvm.AssemblyInfo.cs` file accordingly. - -Run the build script again. - -then: - -```batch -cd Package -..\tools\nuget.exe push -src https://api.nuget.org/v3/index.json .\SrkToolkit.*.1.2.140.nupkg -apikey xxx -``` - - - + +Releasing +================ + +1. Evaluate next version. +2. Change all CSPROJ files to use the new version number (`2\.0\.(\d+)-preview1+` -> `2.0.666-preview2`) +3. Build +4. Commit +5. Build +6. Update the `SrkToolkit.Mvvm.AssemblyInfo.cs` file accordingly. (???) +7. publish +```batch +find . -wholename '*/Release/*2.0.147-*.nupkg' \ + -exec dotnet nuget push "{}" -s https://api.nuget.org/v3/index.json --api-key XXX \; +``` + + + From a74e6ed2b3dec986832bce238de46fbdf48265a0 Mon Sep 17 00:00:00 2001 From: SandRock Date: Wed, 19 Apr 2023 15:45:16 +0200 Subject: [PATCH 25/34] README: info v2 --- README.md | 39 ++++++++++----- snippets/visual-studio/srk.domain.snippet | 60 +++++++++++++++++++++++ 2 files changed, 86 insertions(+), 13 deletions(-) create mode 100644 snippets/visual-studio/srk.domain.snippet diff --git a/README.md b/README.md index dc8255b..193bb90 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ SrkToolkit ========== -Here goes another set of libraries to help out. Separated into a few assemblies to avoid loading too much stuff in your app. +Here goes another set of libraries to help out: SandRock's toolkit. Separated into a few assemblies to avoid loading too much stuff in your app. License: Apache License Version 2.0 @@ -11,28 +11,31 @@ Branches -------------------- - `release/2.0` current major release (WIP) + - `dev/v2.0.0` current development effort - `release/1.2` previous release (hotfixes only) - `release/1.1` old release (hotfixes only) - -Assemblies +Assemblies and nugets -------------------- -### v2.0 (netstandard2.0 and AspNetCore, keep partial support for net46) +### v2.0 (netstandard2.0 and AspNetCore, keep partial support for net46) - "near stable" Keep support for latest .NET Framework and MVC5, full support for AspNetCore. -| Assembly | FX | Nuget | Remark | -|----------------------------------------------------------|-------------------------------|--------------------------------------------------------------------|--------| -| [SrkToolkit.Common](Wiki/SrkToolkit.Common.md) | net46, netstandard2.0, net7.0 | [nuget](https://www.nuget.org/packages/SrkToolkit.Common) | | -| [SrkToolkit.Domain](Wiki/SrkToolkit.Domain.md) | net46, netstandard2.0, net7.0 | [nuget](https://www.nuget.org/packages/SrkToolkit.Domain) | | -| [SrkToolkit.Web.AspMvcCore2](Wiki/SrkToolkit.Web.md) | netstandard2.0, net7.0 | [nuget](https://www.nuget.org/packages/SrkToolkit.Web.AspMvcCore2) | | -| SrkToolkit.Domain.AspMvcCore2 | netstandard2.0, net7.0, | [nuget](https://www.nuget.org/packages/SrkToolkit.Domain.AspMvcCore2) | | +WARNING: work is in progress + +| Assembly | FX | Nuget | Remark | +|----------------------------------------------------------|-------------------------------|----------------------------------------------------------------------------------|--------| +| [SrkToolkit.Common](Wiki/SrkToolkit.Common.md) | net46, netstandard2.0, net7.0 | [nuget](https://www.nuget.org/packages/SrkToolkit.Common) prerelease | | +| [SrkToolkit.Domain](Wiki/SrkToolkit.Domain.md) | net46, netstandard2.0, net7.0 | [nuget](https://www.nuget.org/packages/SrkToolkit.Domain) prerelease | | +| [SrkToolkit.Web.AspMvcCore2](Wiki/SrkToolkit.Web.md) | netstandard2.0, net7.0 | [nuget](https://www.nuget.org/packages/SrkToolkit.Web.AspMvcCore2) prerelease | | +| SrkToolkit.Domain.AspMvcCore2 | netstandard2.0, net7.0, | [nuget](https://www.nuget.org/packages/SrkToolkit.Domain.AspMvcCore2) prerelease | | + -### v1.2 (support for net40 and MVC 4, net45 and MVC 5, netstandard2.0) +### v1.2 (support for net40 and MVC 4, net45 and MVC 5, netstandard2.0) - "stable" -Keep support for many .NET Framework and MVC5, growing support for AspNetCore. +Keep support for many .NET Framework and MVC5, growing support for newer .NET. | Assembly | FX | Nuget | Remark | |----------------------------------------------------------|------------------------------|-----------------------------------------------------------|--------| @@ -44,7 +47,8 @@ Keep support for many .NET Framework and MVC5, growing support for AspNetCore. | SrkToolkit.Domain.AspMvc4 | net45 | [nuget mvc5](https://www.nuget.org/packages/SrkToolkit.Domain.AspMvc5) | | | SrkToolit.WebForms | net40 | | | -### v1.1 (support for net40 and MVC 4, net45 and MVC 5) + +### v1.1 (support for net40 and MVC 4, net45 and MVC 5) - "obsolete" Support for many .NET Framework and MVC4/MVC5. @@ -80,6 +84,14 @@ Content at-a-glance And more... + +### Request-Result-ErrorCode pattern + +`SrkToolkit.Domain` contains a few classes to represent API or domain operations. + +Use the `rrr` [code snippet](snippets/visual-studio/srk.domain.snippet) to obtain a set of types for an operation. + + ### extensions for ASP MVC - [date and time display helpers](Wiki/SrkToolkit.Web-HtmlHelpers.md) (based on timezone, standard formats,