Commit Graph

312 Commits

Author SHA1 Message Date
Paul Johnson
4ae329589a NetCore: MSDI refactor remove IFactory & IRegister (#9308)
* Replace IFactory with IServiceProvider

* Replace IRegister with IServiceCollection

* Fix Rte.cshtml so the view can service locate.

* Replace Composing Lifetime with MSDI ServiceLifetime

* Remove ServiceProvider AddMultipleUnique extension

* Remove Umbraco.Web.Composing.Current.Reset and any calls

* Remove LightInject from net framework projects

* Brought back a helper for setting MediaFileSystem underlying IFileSystem
2020-10-30 12:16:17 +01:00
Bjarke Berg
8c5daec967 Clean in tests + Moved logviewer tests from integration to unit tests, and minimized the test file, to speed up the tests
Signed-off-by: Bjarke Berg <mail@bergmania.dk>
2020-10-28 09:41:23 +01:00
Bjarke Berg
765140b7cd Moved unit tests to right project + Cleanup + Write info in test console
Signed-off-by: Bjarke Berg <mail@bergmania.dk>
2020-10-27 14:10:19 +01:00
Paul Johnson
ec66990e72 NetCore: MSDI refactor phase 2 (#9280)
* Moved adapters from Infra -> Core

* Allow Composition to accept a service collection instead of an IRegister

* Composition no longer takes IRegister as constructor arg

all tests passing

* Composition no longer implements IRegister

* Lose _uniques in Composition

* lose Composition OnCreatingFactory actions

* Clean up UmbracoCoreServiceCollectionExtensions & Composition

Less IFactory

* LightInject gone where TFW == netstandard2.0 || TFW == netcoreapp3.1

* Resolve dead code issues

* Rename IFactory methods to match IServiceProvider so they can be trivially swapped later.

* Rename IFactory methods to match IServiceProvider so they can be trivially swapped later (continued)

Thought the counts were low, it's mostly extension method usage
2020-10-27 11:53:01 +01:00
Bjarke Berg
715071a33f Merge remote-tracking branch 'origin/netcore/task/6973-migrating-authenticationcontroller' into netcore/task/6973-migrating-authenticationcontroller-merge
# Conflicts:
#	src/Umbraco.Web.BackOffice/Controllers/BackOfficeServerVariables.cs
#	src/Umbraco.Web.BackOffice/Extensions/BackOfficeApplicationBuilderExtensions.cs
#	src/Umbraco.Web/Logging/WebProfilerComponent.cs
#	src/Umbraco.Web/Logging/WebProfilerComposer.cs
2020-10-26 14:37:56 +01:00
Bjarke Berg
b47f946ffe Merge remote-tracking branch 'origin/netcore/netcore' into netcore/task/6973-migrating-authenticationcontroller
Signed-off-by: Bjarke Berg <mail@bergmania.dk>

# Conflicts:
#	src/Umbraco.Infrastructure/HealthCheck/NotificationMethods/EmailNotificationMethod.cs
#	src/Umbraco.Web/Editors/AuthenticationController.cs
2020-10-26 14:34:06 +01:00
Andy Butland
507facbdaa NetCore: Further unit test migration (#9269)
* Migrated ContentExtensionsTests.

* Migrated PropertyCollectionTests.

* Migrated AbstractFileSystemTests and PhysicalFileSystem tests.

* Migrated SiteDomainHelper tests.

* Migrated DistributedCacheTests.

* Migrated AppCacheTests and derived test classes.
Amended HttpRequestApp underlying dictionary type to match that available in .NET Core HttpContext Items collection.

* Fixed namespace

Signed-off-by: Bjarke Berg <mail@bergmania.dk>

Co-authored-by: Bjarke Berg <mail@bergmania.dk>
2020-10-26 14:26:49 +01:00
Mole
9cd752c2f8 Netcore: Align Namespaces in Tests and Web.BackOffice (#9274)
* Align namespaces in integration tests

* Align namespaces in unit tests

* Align namespaces in Backoffice.Filters

* Align namespaces in Backoffice.ActionResults

* Align namespaces in Backoffice.Mapping

* Align namespaces in Backoffice.PorpertyEditors and SignalR

* Align namespaces in Backoffice.Trees

* Align unit tests after migration
2020-10-26 13:34:08 +01:00
Paul Johnson
a99f625f6a Netcore: Alternate approach for MSDI refactor (#9247)
* Doesn't make much sense to have Concrete on IRegister, only on IFactory

* Handle FilesTreeController requires IFileSystem of type PhysicalFileSystem

* Handle registration of default MediaFileSystem without using RegisterUniqueFor

* Remove RegisterFor / RegisterUniqueFor from IRegister

* Switch over from LightInject to wrappers around MSDI

* Made mapper dependencies more explicit

* Remove registration for AngularJsonMediaTypeFormatter

It's dependencies aren't registered so container validation fails

* Resolve lifetime issue for EnsureValidSessionId by service locating

else resolve scoped in singleton

* Make registration more explicit for backoffice UserManager

* Make install step registrations more explicit

* Disable service provider validation so site can launch

Maybe this is a problem maybe not, we build about 8000 service providers so maybe everything is fine later...

* Further cleanup of IFactory interface

* Further cleanup of IRegister interface

* Revert "Make registration more explicit for backoffice UserManager"

This reverts commit 7215fe836103c597cd0873c66737a79b91ed4c49.

* Resolve issue where NewInstallStep would fail to reset password for "SuperUser"

Before MSDI, somehow BackOfficeIdentityOptions would be configured with token provider map from IdentityBuilder.AddDefaultTokenProviders.
After switchover those config actions are lost.

Subclass IdentityBuilder to ensure BackOfficeIdentityOptions doesn't miss config setup upstream.

* Initialize current.

* Add todo to turn container validation back on.

* Migrated ScopeFileSystemsTests to integration tests

Signed-off-by: Bjarke Berg <mail@bergmania.dk>

* Resolve issue where MediaFileSystem was skipping ShadowFileSystem

* Attempt to fix ScopeFileSystemsTests on azure devops

Signed-off-by: Bjarke Berg <mail@bergmania.dk>

* Be interesting to know what the actual full path is in pipeline.

* Clarify intent of CreateMediaTest

Doesn't help resolve weird UnauthorizedAccessException but it cuts so much cognitive overhead for the future.

* Use ILoggerfactory rather than mock for the manually constructed file PhysicalFileSystem

* Maybe resolve failing test on azure pipeline.

Co-authored-by: Bjarke Berg <mail@bergmania.dk>
2020-10-26 11:47:14 +01:00
Bjarke Berg
f791bd4426 Fixed unit test, by injecting IHttpContextAccessor instead of using HttpContext directly. Not the test class is mockable again
Signed-off-by: Bjarke Berg <mail@bergmania.dk>
2020-10-23 10:36:47 +02:00
Shannon
64d8b56eca It builds! 2020-10-23 14:18:53 +11:00
Mole
8e321b4364 Migrate Querying tests 2020-10-22 15:31:56 +02:00
Mole
b28548849f Migrate the bare minimum of BaseUsingSqlCeSyntax to be able to migrate NPoco unit tests 2020-10-22 15:17:16 +02:00
Mole
016d3f2b5b Move NPoco unit tests back out of Integration tests 2020-10-22 14:50:01 +02:00
Shannon
2b1dfc5888 Merge remote-tracking branch 'origin/netcore/netcore' into netcore/task/6973-migrating-authenticationcontroller
# Conflicts:
#	src/Umbraco.Tests.Integration/Testing/UmbracoIntegrationTest.cs
#	src/Umbraco.Tests/Web/Mvc/UmbracoViewPageTests.cs
#	src/Umbraco.Web.BackOffice/Controllers/BackOfficeController.cs
#	src/Umbraco.Web/Editors/BackOfficeController.cs
#	src/Umbraco.Web/Mvc/UmbracoController.cs
2020-10-22 21:16:44 +11:00
Mole
0dc95edea4 Merge remote-tracking branch 'origin/netcore/netcore' into netcore/feature/migrate-persistance-tests 2020-10-22 09:49:40 +02:00
berg
070307ea88 Ensure unit tests run on linux
Signed-off-by: berg <mail@bergmania.dk>
2020-10-21 21:04:10 +02:00
Emma L Garland
7a570110d0 Netcore/feature/healthcheck replaceconfiglogic (#8934)
* Started moving to JSON instead of config.
Mild refactoring but overall keeping it the same, except for injecting IConfiguration and JSON parsing instead of XML
Tests currently unaffected, need to increase coverage

* Moved to constants for appsettings keys
Moved from IConfiguration to global settings - later to be replaced with IOptions
Updated translation messages
Installed IOptions ready for new PR
Updated to new interface, IConfigurationService

* Post-merge fix

* Namespace move from Umbraco.Web to Umbraco.Core where appropriate

* Renamed abstractsettings (from abstractconfig)
Moving out of configservice into the POCO config check

* Made the IIsCustomErrors healthcheck as obsolete, as no web.config setting). Investigate reintroducing this check in the .NET Core way (UseDevelopment).
Reducing use of abstractsettings as not needed - we don't need a config service to read the config settings anymore as they're all explicit POCOs.
Consolidated health-checks in project.

* Removed test views that weren't meant to be added

* Returned to use of abstractsettings with different use

* Moved more health checks into correct folder/namespace, and enum into their own file

* Correct namespace

* Git history/compare lost due to file move, temporarily moving back to original folder. Will do another PR to move after this

* Use existing GetStatus in abstract check for Debug mode

* Updating to return to previous logic and putting files back into line

* Macro errors returned to previous logic

* Reuse abstractsettings class

* Swapped order to assist with reviewing PR

* Updated to include itempath

* Not implemented comment to avoid confusion
Implemented NotificationEmailCheck

* Changed to IOptionsMonitor as per PR comments. Removed configurationservice as we need to rethink the fixing strategy. Updated logger.
Needs to show fix message instead of fixing. Temporary fix for IIS version

* Switched to IOptionsMonitor for all

* No longer attempts to actually fix header in config. Still need to show suggestions.

Co-authored-by: Elitsa Marinovska <elm@umbraco.dk>
2020-10-21 11:29:25 +02:00
Bjarke Berg
2bb3afb69d Merge pull request #9227 from umbraco/netcore/feature/migrate-unit-tests
Netcore: Migrate rendering related unit tests
2020-10-21 10:51:12 +02:00
Mole
90f3a70e8e Remove MapperTestBase and move functionality to TestHelper instead 2020-10-21 08:50:15 +02:00
Shannon
d1b35deb43 Migrates remaining backofficecontroller but still a bunch of work to do , streamlines Backoffice to BackOffice (but is that what we want?) 2020-10-21 16:51:00 +11:00
Bjarke Berg
35c22f9074 Introduced SetViewDataAsync on UmbracoViewPage
Signed-off-by: Bjarke Berg <mail@bergmania.dk>
2020-10-20 21:30:45 +02:00
Mole
fb6ad57271 Move BulkDataReaderTests to unit test project and fix csproj files 2020-10-20 15:32:34 +02:00
Mole
c5a34ad7b9 Merge remote-tracking branch 'origin/netcore/netcore' into netcore/feature/migrate-persistance-tests 2020-10-20 15:08:32 +02:00
Mole
0e5d035f65 Move the remaining mapper tests 2020-10-20 14:58:59 +02:00
Andy Butland
5e70c503cd NetCore: migrated further unit tests (#9211)
* Moved model unit tests into correct folder and namespace.

* Migrated ContentTests.

* Migrated VariationTests.

* Migrated ImageSharpImageUrlGeneratorTests.

* Fixes to integration tests.

* Unit and integration test updates from PR comments.

* Delete accidentally added log file.
2020-10-20 14:49:52 +02:00
Mole
1f0a935505 Move MapperTestBase and ContentMapperTest into unit tests 2020-10-20 14:44:30 +02:00
Mole
d315d2120e Migrate UmbracoViewPageTests 2020-10-20 13:41:21 +02:00
Mole
a88243b9ba Try and fix the merge 2020-10-20 09:06:42 +02:00
Mole
e87caac0dd Merge remote-tracking branch 'origin/netcore/netcore' into netcore/feature/move-tests
# Conflicts:
#	src/Umbraco.Tests.Common/TestHelpers/MockedValueEditors.cs
#	src/Umbraco.Tests.Common/TestHelpers/StringNewlineExtensions.cs
#	src/Umbraco.Tests.UnitTests/TestHelpers/TestHelper.cs
#	src/Umbraco.Tests.UnitTests/Umbraco.Core/CoreThings/ObjectExtensionsTests.cs
#	src/Umbraco.Tests.UnitTests/Umbraco.Core/Manifest/ManifestContentAppTests.cs
#	src/Umbraco.Tests.UnitTests/Umbraco.Core/Manifest/ManifestParserTests.cs
#	src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Macros/MacroParserTests.cs
#	src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Manifest/ManifestContentAppTests.cs
#	src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Manifest/ManifestParserTests.cs
#	src/Umbraco.Tests.UnitTests/Umbraco.Web.Common/Macros/MacroParserTests.cs
#	src/Umbraco.Tests/Macros/MacroParserTests.cs
#	src/Umbraco.Tests/Manifest/ManifestContentAppTests.cs
#	src/Umbraco.Tests/Manifest/ManifestParserTests.cs
#	src/Umbraco.Web.UI.NetCore/umbraco/UmbracoBackOffice/Default.cshtml
2020-10-20 08:40:41 +02:00
Mole
5f114e7228 Align ContentModelBinderTests to new behaviour 2020-10-19 14:34:08 +02:00
Mole
c3e92a91b5 Mingrate RenderModelBinderTests 2020-10-19 14:03:51 +02:00
Bjarke Berg
b27732adc8 Migrated RenderMvcController and RenderIndexActionSelectorAttribute
Signed-off-by: Bjarke Berg <mail@bergmania.dk>
2020-10-15 11:42:16 +02:00
Andy Butland
ef962b6934 Migrated ContentServiceTests. 2020-10-11 22:31:54 +02:00
Andy Butland
874e585bfb Migrated EntityXmlSerializerTests. Also aligned namespaces and update LocalizationServiceTests to use test model builders. 2020-10-10 18:25:18 +02:00
Mole
2418b616a6 Merge pull request #9102 from AndyButland/feature/7898-services-integration-tests-migration-3
NetCore: make use of builder classes for model creation in migrated tests
2020-10-08 17:03:23 +02:00
Andy Butland
78c4a17503 Resolved issues after rebase from main branch.
Fixed failing tests where test model builders showing slightly different behaviour to those used from legacy tests.
2020-10-07 14:54:14 +02:00
Mole
17c68176e0 Merge pull request #9100 from umbraco/netcore/task/6964-legacy-password-format
Adds support for the super old password format so we can handle upgrades
2020-10-07 11:25:51 +02:00
Shannon
eaa295095d Gets password roll forward working 2020-10-07 16:56:48 +11:00
Shannon
e5c272b5d2 Adds support for the super old password format so we can handle upgrades 2020-10-07 15:20:43 +11:00
Bjarke Berg
3551d6e65e Clean up and fixed todos
Signed-off-by: Bjarke Berg <mail@bergmania.dk>
2020-10-06 21:23:15 +02:00
Bjarke Berg
413b410bfb use mocks in unit test instead of real console logger
Signed-off-by: Bjarke Berg <mail@bergmania.dk>
2020-10-06 20:10:54 +02:00
Bjarke Berg
baf2aaecab Merge remote-tracking branch 'origin/netcore/netcore' into netcore/feature/migrate-logging
Signed-off-by: Bjarke Berg <mail@bergmania.dk>

# Conflicts:
#	src/Umbraco.Infrastructure/Runtime/CoreInitialComposer.cs
#	src/Umbraco.Tests.Integration/Packaging/CreatedPackagesRepositoryTests.cs
#	src/Umbraco.Tests.Integration/Services/CachedDataTypeServiceTests.cs
#	src/Umbraco.Tests.Integration/Services/DataTypeServiceTests.cs
#	src/Umbraco.Tests.Integration/Services/MacroServiceTests.cs
#	src/Umbraco.Tests.Integration/Testing/UmbracoIntegrationTest.cs
#	src/Umbraco.Tests.UnitTests/Umbraco.Core/Services/LocalizedTextServiceTests.cs
2020-10-06 18:49:03 +02:00
Mole
23aee8bd4e Merge remote-tracking branch 'origin/netcore/netcore' into netcore/feature/8518-migrate-tests
# Conflicts:
#	src/Umbraco.Tests.Integration/Services/MacroServiceTests.cs
#	src/Umbraco.Tests.Integration/Testing/UmbracoIntegrationTest.cs
2020-10-06 15:16:28 +02:00
Mole
c7aad452ee Clean 2020-10-06 14:16:29 +02:00
Mole
32b43feac4 Remove unused imports 2020-10-06 13:45:21 +02:00
Andy Butland
8e48f2cc31 Further updates from PR comments and additional use of test model builders. 2020-10-06 13:24:32 +02:00
Mole
65bd5ea3ef Move AngularIntegrationTests
They all say they belong to Web but their implementations are in Core/Infrastructure/Backoffice, so I assume they belong in the new test suite
2020-10-06 13:11:44 +02:00
Mole
da5f9e7520 Migrate MacroParserTests
While the namespace is Umbraco.Web.Macros the implementation is in Umbraco.Infrastructure assembly, so I assume it has been migrated.
2020-10-06 13:02:29 +02:00
Andy Butland
11dc3459bc Further update to user service and controller tests to use test builders. 2020-10-06 12:02:29 +02:00