Skip to content

Commit

Permalink
Implements the ToString() method for the object model.
Browse files Browse the repository at this point in the history
  • Loading branch information
GillesTourreau committed Sep 24, 2024
1 parent 95a5302 commit 66d3e90
Show file tree
Hide file tree
Showing 28 changed files with 427 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,11 @@ internal SqlCheckConstraint()

/// <inheritdoc />
public override TResult Accept<TResult>(ISqlObjectVisitor<TResult> visitor) => visitor.Visit(this);

/// <inheritdoc cref="Name"/>
public override string ToString()
{
return this.Name;
}
}
}
6 changes: 6 additions & 0 deletions src/UnitTests.Databases.SqlServer/ObjectModel/SqlColumn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,11 @@ internal SqlColumn()

/// <inheritdoc />
public override TResult Accept<TResult>(ISqlObjectVisitor<TResult> visitor) => visitor.Visit(this);

/// <inheritdoc cref="Name"/>
public override string ToString()
{
return this.Name;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,11 @@ internal SqlForeignKey(IList<SqlForeignKeyColumn> columns)

/// <inheritdoc />
public override TResult Accept<TResult>(ISqlObjectVisitor<TResult> visitor) => visitor.Visit(this);

/// <inheritdoc cref="Name"/>
public override string ToString()
{
return this.Name;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,11 @@ internal SqlForeignKeyColumn()

/// <inheritdoc />
public override TResult Accept<TResult>(ISqlObjectVisitor<TResult> visitor) => visitor.Visit(this);

/// <inheritdoc cref="Name"/>
public override string ToString()
{
return $"{this.Name} => {this.Referenced}";
}
}
}
6 changes: 6 additions & 0 deletions src/UnitTests.Databases.SqlServer/ObjectModel/SqlIndex.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,11 @@ internal SqlIndex(IList<SqlIndexColumn> columns, IList<SqlIndexColumn> includedC

/// <inheritdoc />
public override TResult Accept<TResult>(ISqlObjectVisitor<TResult> visitor) => visitor.Visit(this);

/// <inheritdoc cref="Name"/>
public override string ToString()
{
return this.Name;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,11 @@ internal SqlIndexColumn()

/// <inheritdoc />
public override TResult Accept<TResult>(ISqlObjectVisitor<TResult> visitor) => visitor.Visit(this);

/// <inheritdoc cref="Name"/>
public override string ToString()
{
return this.Name;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,11 @@ internal SqlPrimaryKey(IList<SqlPrimaryKeyColumn> columns)

/// <inheritdoc />
public override TResult Accept<TResult>(ISqlObjectVisitor<TResult> visitor) => visitor.Visit(this);

/// <inheritdoc cref="Name"/>
public override string ToString()
{
return this.Name;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,11 @@ internal SqlPrimaryKeyColumn()

/// <inheritdoc />
public override TResult Accept<TResult>(ISqlObjectVisitor<TResult> visitor) => visitor.Visit(this);

/// <inheritdoc cref="Name"/>
public override string ToString()
{
return this.Name;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,11 @@ internal SqlStoredProcedure()

/// <inheritdoc />
public override TResult Accept<TResult>(ISqlObjectVisitor<TResult> visitor) => visitor.Visit(this);

/// <inheritdoc cref="Name"/>
public override string ToString()
{
return $"{this.Schema}.{this.Name}";
}
}
}
6 changes: 6 additions & 0 deletions src/UnitTests.Databases.SqlServer/ObjectModel/SqlTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,11 @@ internal SqlTable(IList<SqlColumn> columns, IList<SqlTrigger> triggers, IList<Sq

/// <inheritdoc />
public override TResult Accept<TResult>(ISqlObjectVisitor<TResult> visitor) => visitor.Visit(this);

/// <inheritdoc cref="Name"/>
public override string ToString()
{
return $"{this.Schema}.{this.Name}";
}
}
}
6 changes: 6 additions & 0 deletions src/UnitTests.Databases.SqlServer/ObjectModel/SqlTrigger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,11 @@ internal SqlTrigger()

/// <inheritdoc />
public override TResult Accept<TResult>(ISqlObjectVisitor<TResult> visitor) => visitor.Visit(this);

/// <inheritdoc cref="Name"/>
public override string ToString()
{
return this.Name;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,11 @@ internal SqlUniqueConstraint(IList<SqlIndexColumn> columns)

/// <inheritdoc />
public override TResult Accept<TResult>(ISqlObjectVisitor<TResult> visitor) => visitor.Visit(this);

/// <inheritdoc cref="Name"/>
public override string ToString()
{
return this.Name;
}
}
}
6 changes: 6 additions & 0 deletions src/UnitTests.Databases.SqlServer/ObjectModel/SqlUserType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,11 @@ internal SqlUserType()

/// <inheritdoc />
public override TResult Accept<TResult>(ISqlObjectVisitor<TResult> visitor) => visitor.Visit(this);

/// <inheritdoc cref="Name"/>
public override string ToString()
{
return this.Name;
}
}
}
6 changes: 6 additions & 0 deletions src/UnitTests.Databases.SqlServer/ObjectModel/SqlView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,11 @@ internal SqlView()

/// <inheritdoc />
public override TResult Accept<TResult>(ISqlObjectVisitor<TResult> visitor) => visitor.Visit(this);

/// <inheritdoc cref="Name"/>
public override string ToString()
{
return $"{this.Schema}.{this.Name}";
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//-----------------------------------------------------------------------
// <copyright file="SqlCheckConstraintTest.cs" company="P.O.S Informatique">
// Copyright (c) P.O.S Informatique. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace PosInformatique.UnitTests.Databases.Tests
{
public class SqlCheckConstraintTest
{
[Fact]
public void ToStringTest()
{
var checkConstraint = new SqlCheckConstraint()
{
Name = "The name",
Code = default,
};

checkConstraint.ToString().Should().Be("The name");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//-----------------------------------------------------------------------
// <copyright file="SqlColumnTest.cs" company="P.O.S Informatique">
// Copyright (c) P.O.S Informatique. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace PosInformatique.UnitTests.Databases.Tests
{
public class SqlColumnTest
{
[Fact]
public void ToStringTest()
{
var column = new SqlColumn()
{
Name = "The name",
CollationName = default,
ComputedExpression = default,
IsComputed = default,
IsIdentity = default,
IsNullable = default,
MaxLength = default,
Position = default,
Precision = default,
Scale = default,
SystemTypeId = default,
TypeName = default,
};

column.ToString().Should().Be("The name");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//-----------------------------------------------------------------------
// <copyright file="SqlForeignKeyColumnTest.cs" company="P.O.S Informatique">
// Copyright (c) P.O.S Informatique. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace PosInformatique.UnitTests.Databases.Tests
{
public class SqlForeignKeyColumnTest
{
[Fact]
public void ToStringTest()
{
var column = new SqlForeignKeyColumn()
{
Name = "The name",
Referenced = "The referenced",
Position = default,
};

column.ToString().Should().Be("The name => The referenced");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//-----------------------------------------------------------------------
// <copyright file="SqlForeignKeyTest.cs" company="P.O.S Informatique">
// Copyright (c) P.O.S Informatique. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace PosInformatique.UnitTests.Databases.Tests
{
public class SqlForeignKeyTest
{
[Fact]
public void ToStringTest()
{
var foreignKey = new SqlForeignKey([])
{
DeleteAction = default,
ReferencedTable = default,
UpdateAction = default,
Name = "The name",
};

foreignKey.ToString().Should().Be("The name");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//-----------------------------------------------------------------------
// <copyright file="SqlIndexColumnTest.cs" company="P.O.S Informatique">
// Copyright (c) P.O.S Informatique. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace PosInformatique.UnitTests.Databases.Tests
{
public class SqlIndexColumnTest
{
[Fact]
public void ToStringTest()
{
var column = new SqlIndexColumn()
{
Name = "The name",
Position = default,
};

column.ToString().Should().Be("The name");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//-----------------------------------------------------------------------
// <copyright file="SqlIndexTest.cs" company="P.O.S Informatique">
// Copyright (c) P.O.S Informatique. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace PosInformatique.UnitTests.Databases.Tests
{
public class SqlIndexTest
{
[Fact]
public void ToStringTest()
{
var index = new SqlIndex(Array.Empty<SqlIndexColumn>(), Array.Empty<SqlIndexColumn>())
{
Filter = null,
IsUnique = default,
Name = "The name",
Type = default,
};

index.ToString().Should().Be("The name");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//-----------------------------------------------------------------------
// <copyright file="SqlPrimaryKeyColumnTest.cs" company="P.O.S Informatique">
// Copyright (c) P.O.S Informatique. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace PosInformatique.UnitTests.Databases.Tests
{
public class SqlPrimaryKeyColumnTest
{
[Fact]
public void ToStringTest()
{
var column = new SqlPrimaryKeyColumn()
{
Name = "The name",
Position = default,
};

column.ToString().Should().Be("The name");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//-----------------------------------------------------------------------
// <copyright file="SqlPrimaryKeyTest.cs" company="P.O.S Informatique">
// Copyright (c) P.O.S Informatique. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace PosInformatique.UnitTests.Databases.Tests
{
public class SqlPrimaryKeyTest
{
[Fact]
public void ToStringTest()
{
var primaryKey = new SqlPrimaryKey([])
{
Name = "The name",
Type = default,
};

primaryKey.ToString().Should().Be("The name");
}
}
}
Loading

0 comments on commit 66d3e90

Please sign in to comment.