|
| 1 | +using System.IO; |
| 2 | + |
1 | 3 | using EntityFrameworkCore.Generator.Options; |
| 4 | + |
2 | 5 | using FluentAssertions; |
| 6 | + |
3 | 7 | using FluentCommand.SqlServer.Tests; |
| 8 | + |
4 | 9 | using Microsoft.Extensions.Logging.Abstractions; |
5 | | -using System.IO; |
| 10 | + |
6 | 11 | using Xunit; |
7 | 12 | using Xunit.Abstractions; |
8 | 13 |
|
@@ -40,39 +45,40 @@ public void Generate_Should_Work_For_Password_With_CurlyBrace() |
40 | 45 |
|
41 | 46 | result.Should().BeTrue(); |
42 | 47 | } |
43 | | - [Fact] |
44 | | - public void GenerateSpatial() |
45 | | - { |
46 | | - var generatorOptions = new GeneratorOptions(); |
47 | | - generatorOptions.Database.ConnectionString = Database.ConnectionString; |
48 | 48 |
|
49 | | - var generator = new CodeGenerator(NullLoggerFactory.Instance); |
50 | | - var result = generator.Generate(generatorOptions); |
| 49 | + [Fact] |
| 50 | + public void GenerateSpatial() |
| 51 | + { |
| 52 | + var generatorOptions = new GeneratorOptions(); |
| 53 | + generatorOptions.Database.ConnectionString = Database.ConnectionString; |
| 54 | + |
| 55 | + var generator = new CodeGenerator(NullLoggerFactory.Instance); |
| 56 | + var result = generator.Generate(generatorOptions); |
51 | 57 |
|
52 | | - result.Should().BeTrue(); |
| 58 | + result.Should().BeTrue(); |
53 | 59 |
|
54 | | - const string spatialTableName = "CitiesSpatial"; |
| 60 | + const string spatialTableName = "CitiesSpatial"; |
55 | 61 |
|
56 | | - var citiesSpatialEntityFile = Path.Combine(generatorOptions.Data.Entity.Directory, spatialTableName + ".cs"); |
57 | | - var citiesSpatialMappingFile = Path.Combine(generatorOptions.Data.Mapping.Directory, spatialTableName + "Map.cs"); |
| 62 | + var citiesSpatialEntityFile = Path.Combine(generatorOptions.Data.Entity.Directory, spatialTableName + ".cs"); |
| 63 | + var citiesSpatialMappingFile = Path.Combine(generatorOptions.Data.Mapping.Directory, spatialTableName + "Map.cs"); |
58 | 64 |
|
59 | | - var citiesSpatialEntityContent = File.ReadAllText(citiesSpatialEntityFile); |
60 | | - var citiesSpatialMappingContent = File.ReadAllText(citiesSpatialMappingFile); |
| 65 | + var citiesSpatialEntityContent = File.ReadAllText(citiesSpatialEntityFile); |
| 66 | + var citiesSpatialMappingContent = File.ReadAllText(citiesSpatialMappingFile); |
61 | 67 |
|
62 | | - citiesSpatialEntityContent.Contains("public NetTopologySuite.Geometries.Geometry GeometryField { get; set; }").Should().BeTrue(); |
63 | | - citiesSpatialEntityContent.Contains("public NetTopologySuite.Geometries.Geometry GeographyField { get; set; }").Should().BeTrue(); |
| 68 | + citiesSpatialEntityContent.Contains("public NetTopologySuite.Geometries.Geometry GeometryField { get; set; }").Should().BeTrue(); |
| 69 | + citiesSpatialEntityContent.Contains("public NetTopologySuite.Geometries.Geometry GeographyField { get; set; }").Should().BeTrue(); |
64 | 70 |
|
65 | | - citiesSpatialMappingContent.Contains("builder.Property(t => t.GeometryField)" + System.Environment.NewLine + |
| 71 | + citiesSpatialMappingContent.Contains("builder.Property(t => t.GeometryField)" + System.Environment.NewLine + |
66 | 72 | " .IsRequired()" + System.Environment.NewLine + |
67 | 73 | " .HasColumnName(\"GeometryField\")" + System.Environment.NewLine + |
68 | 74 | " .HasColumnType(\"geometry\");").Should().BeTrue(); |
69 | 75 |
|
70 | | - citiesSpatialMappingContent.Contains("builder.Property(t => t.GeographyField)" + System.Environment.NewLine + |
| 76 | + citiesSpatialMappingContent.Contains("builder.Property(t => t.GeographyField)" + System.Environment.NewLine + |
71 | 77 | " .IsRequired()" + System.Environment.NewLine + |
72 | 78 | " .HasColumnName(\"GeographyField\")" + System.Environment.NewLine + |
73 | 79 | " .HasColumnType(\"geography\");").Should().BeTrue(); |
74 | 80 |
|
75 | | - } |
| 81 | + } |
76 | 82 |
|
77 | 83 | } |
78 | 84 |
|
0 commit comments