File tree Expand file tree Collapse file tree 17 files changed +272
-69
lines changed
Storage.MongoDB.Specs/for_PropertyExtensions/when_converting_to_mongo_db Expand file tree Collapse file tree 17 files changed +272
-69
lines changed Original file line number Diff line number Diff line change 1+ // Copyright (c) Cratis. All rights reserved.
2+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3+
4+ using Cratis . Chronicle . Properties ;
5+
6+ namespace Cratis . Chronicle . Storage . MongoDB . for_PropertyExtensions . when_converting_to_mongo_db ;
7+
8+ public class with_array_and_child_property : Specification
9+ {
10+ PropertyPath _propertyPath ;
11+ string _result ;
12+
13+ void Establish ( ) => _propertyPath = new PropertyPath ( "[Configurations].ConfigurationId" ) ;
14+
15+ void Because ( ) => _result = _propertyPath . ToMongoDB ( ) ;
16+
17+ [ Fact ] void should_remove_brackets_and_preserve_casing ( ) => _result . ShouldEqual ( "Configurations.ConfigurationId" ) ;
18+ }
Original file line number Diff line number Diff line change 1+ // Copyright (c) Cratis. All rights reserved.
2+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3+
4+ using Cratis . Chronicle . Properties ;
5+
6+ namespace Cratis . Chronicle . Storage . MongoDB . for_PropertyExtensions . when_converting_to_mongo_db ;
7+
8+ public class with_array_and_id_child_property : Specification
9+ {
10+ PropertyPath _propertyPath ;
11+ string _result ;
12+
13+ void Establish ( ) => _propertyPath = new PropertyPath ( "[Configurations].Id" ) ;
14+
15+ void Because ( ) => _result = _propertyPath . ToMongoDB ( ) ;
16+
17+ [ Fact ] void should_convert_id_to_underscore_id ( ) => _result . ShouldEqual ( "Configurations._id" ) ;
18+ }
Original file line number Diff line number Diff line change 1+ // Copyright (c) Cratis. All rights reserved.
2+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3+
4+ using Cratis . Chronicle . Properties ;
5+
6+ namespace Cratis . Chronicle . Storage . MongoDB . for_PropertyExtensions . when_converting_to_mongo_db ;
7+
8+ public class with_array_property : Specification
9+ {
10+ PropertyPath _propertyPath ;
11+ string _result ;
12+
13+ void Establish ( ) => _propertyPath = new PropertyPath ( "[Configurations]" ) ;
14+
15+ void Because ( ) => _result = _propertyPath . ToMongoDB ( ) ;
16+
17+ [ Fact ] void should_remove_brackets_and_preserve_casing ( ) => _result . ShouldEqual ( "Configurations" ) ;
18+ }
Original file line number Diff line number Diff line change 1+ // Copyright (c) Cratis. All rights reserved.
2+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3+
4+ using Cratis . Chronicle . Properties ;
5+
6+ namespace Cratis . Chronicle . Storage . MongoDB . for_PropertyExtensions . when_converting_to_mongo_db ;
7+
8+ public class with_complex_path : Specification
9+ {
10+ PropertyPath _propertyPath ;
11+ string _result ;
12+
13+ void Establish ( ) => _propertyPath = new PropertyPath ( "Organization.[Departments].[Employees].FirstName" ) ;
14+
15+ void Because ( ) => _result = _propertyPath . ToMongoDB ( ) ;
16+
17+ [ Fact ] void should_convert_entire_path_correctly ( ) => _result . ShouldEqual ( "Organization.Departments.Employees.FirstName" ) ;
18+ }
Original file line number Diff line number Diff line change 1+ // Copyright (c) Cratis. All rights reserved.
2+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3+
4+ using Cratis . Chronicle . Properties ;
5+
6+ namespace Cratis . Chronicle . Storage . MongoDB . for_PropertyExtensions . when_converting_to_mongo_db ;
7+
8+ public class with_deeply_nested_path_with_id : Specification
9+ {
10+ PropertyPath _propertyPath ;
11+ string _result ;
12+
13+ void Establish ( ) => _propertyPath = new PropertyPath ( "[Configurations].[Hubs].Id" ) ;
14+
15+ void Because ( ) => _result = _propertyPath . ToMongoDB ( ) ;
16+
17+ [ Fact ] void should_convert_id_to_underscore_id ( ) => _result . ShouldEqual ( "Configurations.Hubs._id" ) ;
18+ }
Original file line number Diff line number Diff line change 1+ // Copyright (c) Cratis. All rights reserved.
2+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3+
4+ using Cratis . Chronicle . Properties ;
5+
6+ namespace Cratis . Chronicle . Storage . MongoDB . for_PropertyExtensions . when_converting_to_mongo_db ;
7+
8+ public class with_id_property : Specification
9+ {
10+ PropertyPath _propertyPath ;
11+ string _result ;
12+
13+ void Establish ( ) => _propertyPath = new PropertyPath ( "Id" ) ;
14+
15+ void Because ( ) => _result = _propertyPath . ToMongoDB ( ) ;
16+
17+ [ Fact ] void should_return_underscore_id ( ) => _result . ShouldEqual ( "_id" ) ;
18+ }
Original file line number Diff line number Diff line change 1+ // Copyright (c) Cratis. All rights reserved.
2+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3+
4+ using Cratis . Chronicle . Properties ;
5+
6+ namespace Cratis . Chronicle . Storage . MongoDB . for_PropertyExtensions . when_converting_to_mongo_db ;
7+
8+ public class with_lowercase_id_property : Specification
9+ {
10+ PropertyPath _propertyPath ;
11+ string _result ;
12+
13+ void Establish ( ) => _propertyPath = new PropertyPath ( "id" ) ;
14+
15+ void Because ( ) => _result = _propertyPath . ToMongoDB ( ) ;
16+
17+ [ Fact ] void should_return_underscore_id ( ) => _result . ShouldEqual ( "_id" ) ;
18+ }
Original file line number Diff line number Diff line change 1+ // Copyright (c) Cratis. All rights reserved.
2+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3+
4+ using Cratis . Chronicle . Properties ;
5+
6+ namespace Cratis . Chronicle . Storage . MongoDB . for_PropertyExtensions . when_converting_to_mongo_db ;
7+
8+ public class with_nested_arrays : Specification
9+ {
10+ PropertyPath _propertyPath ;
11+ string _result ;
12+
13+ void Establish ( ) => _propertyPath = new PropertyPath ( "[Configurations].[Hubs].Name" ) ;
14+
15+ void Because ( ) => _result = _propertyPath . ToMongoDB ( ) ;
16+
17+ [ Fact ] void should_remove_all_brackets_and_preserve_casing ( ) => _result . ShouldEqual ( "Configurations.Hubs.Name" ) ;
18+ }
Original file line number Diff line number Diff line change 1+ // Copyright (c) Cratis. All rights reserved.
2+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3+
4+ using Cratis . Chronicle . Properties ;
5+
6+ namespace Cratis . Chronicle . Storage . MongoDB . for_PropertyExtensions . when_converting_to_mongo_db ;
7+
8+ public class with_nested_id_property : Specification
9+ {
10+ PropertyPath _propertyPath ;
11+ string _result ;
12+
13+ void Establish ( ) => _propertyPath = new PropertyPath ( "User.Id" ) ;
14+
15+ void Because ( ) => _result = _propertyPath . ToMongoDB ( ) ;
16+
17+ [ Fact ] void should_convert_id_to_underscore_id ( ) => _result . ShouldEqual ( "User._id" ) ;
18+ }
Original file line number Diff line number Diff line change 1+ // Copyright (c) Cratis. All rights reserved.
2+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3+
4+ using Cratis . Chronicle . Properties ;
5+
6+ namespace Cratis . Chronicle . Storage . MongoDB . for_PropertyExtensions . when_converting_to_mongo_db ;
7+
8+ public class with_nested_property : Specification
9+ {
10+ PropertyPath _propertyPath ;
11+ string _result ;
12+
13+ void Establish ( ) => _propertyPath = new PropertyPath ( "User.FirstName" ) ;
14+
15+ void Because ( ) => _result = _propertyPath . ToMongoDB ( ) ;
16+
17+ [ Fact ] void should_preserve_original_casing ( ) => _result . ShouldEqual ( "User.FirstName" ) ;
18+ }
You can’t perform that action at this time.
0 commit comments