Skip to content

Commit d18095d

Browse files
authored
Remove copied test shared code from Tables extension (Azure#25998)
1 parent 54db2ab commit d18095d

12 files changed

+52
-351
lines changed

sdk/tables/Microsoft.Azure.WebJobs.Extensions.Tables/tests/Microsoft.Azure.WebJobs.Extensions.Tables.Tests.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<PackageReference Include="NUnit3TestAdapter" />
1111
<PackageReference Include="Microsoft.Azure.WebJobs" />
1212
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Http" />
13+
<PackageReference Include="Microsoft.Extensions.Configuration.Json" />
1314
<PackageReference Include="Microsoft.NET.Test.Sdk" />
1415
<PackageReference Include="Moq" />
1516
</ItemGroup>
@@ -24,7 +25,7 @@
2425
<Compile Remove="EntityPropertyToTConverterFactoryTests.cs" />
2526
<Compile Remove="TToEntityPropertyConverterFactoryTests.cs" />
2627

27-
<Compile Include="..\..\Azure.Data.Tables\tests\TablesTestEnvironment.cs" />
28+
<Compile Include="..\..\Azure.Data.Tables\tests\TablesTestEnvironment.cs" LinkBase="Shared" />
29+
<Compile Include="..\..\..\extensions\Microsoft.Azure.WebJobs.Extensions.Clients\tests\shared\*.cs" LinkBase="Shared" />
2830
</ItemGroup>
29-
3031
</Project>

sdk/tables/Microsoft.Azure.WebJobs.Extensions.Tables/tests/PocoToTableEntityConverterTests.cs

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,67 +25,72 @@ public void Create_ReturnsInstance()
2525
public void Create_IfPartitionKeyIsNonString_Throws()
2626
{
2727
// Act & Assert
28-
ExceptionAssert.ThrowsInvalidOperation(
29-
() => new PocoToTableEntityConverter<PocoWithNonStringPartitionKey>(),
30-
"If the PartitionKey property is present, it must be a String.");
28+
var exception = Assert.Throws<InvalidOperationException>(() => new PocoToTableEntityConverter<PocoWithNonStringPartitionKey>());
29+
30+
Assert.AreEqual("If the PartitionKey property is present, it must be a String.", exception.Message);
3131
}
3232

3333
[Test]
3434
public void Create_IfPartitionKeyHasIndexParameters_Throws()
3535
{
3636
// Act & Assert
37-
ExceptionAssert.ThrowsInvalidOperation(
38-
() => new PocoToTableEntityConverter<PocoWithIndexerPartitionKey>(),
39-
"If the PartitionKey property is present, it must not be an indexer.");
37+
var exception = Assert.Throws<InvalidOperationException>(() => new PocoToTableEntityConverter<PocoWithIndexerPartitionKey>());
38+
39+
Assert.AreEqual(exception.Message, "If the PartitionKey property is present, it must not be an indexer.");
4040
}
4141

4242
[Test]
4343
public void Create_IfRowKeyIsNonString_Throws()
4444
{
4545
// Act & Assert
46-
ExceptionAssert.ThrowsInvalidOperation(() => new PocoToTableEntityConverter<PocoWithNonStringRowKey>(),
47-
"If the RowKey property is present, it must be a String.");
46+
var exception = Assert.Throws<InvalidOperationException>(() => new PocoToTableEntityConverter<PocoWithNonStringRowKey>());
47+
48+
Assert.AreEqual("If the RowKey property is present, it must be a String.", exception.Message);
4849
}
4950

5051
[Test]
5152
public void Create_IfRowKeyHasIndexParameters_Throws()
5253
{
5354
// Act & Assert
54-
ExceptionAssert.ThrowsInvalidOperation(() => new PocoToTableEntityConverter<PocoWithIndexerRowKey>(),
55-
"If the RowKey property is present, it must not be an indexer.");
55+
var exception = Assert.Throws<InvalidOperationException>(() => new PocoToTableEntityConverter<PocoWithIndexerRowKey>());
56+
57+
Assert.AreEqual("If the RowKey property is present, it must not be an indexer.", exception.Message);
5658
}
5759

5860
[Test]
5961
public void Create_IfTimestampIsNonDateTimeOffset_Throws()
6062
{
6163
// Act & Assert
62-
ExceptionAssert.ThrowsInvalidOperation(
63-
() => new PocoToTableEntityConverter<PocoWithNonDateTimeOffsetTimestamp>(),
64-
"If the Timestamp property is present, it must be a DateTimeOffset.");
64+
var exception = Assert.Throws<InvalidOperationException>(() => new PocoToTableEntityConverter<PocoWithNonDateTimeOffsetTimestamp>());
65+
66+
Assert.AreEqual("If the Timestamp property is present, it must be a DateTimeOffset.", exception.Message);
6567
}
6668

6769
[Test]
6870
public void Create_IfTimestampHasIndexParameters_Throws()
6971
{
7072
// Act & Assert
71-
ExceptionAssert.ThrowsInvalidOperation(() => new PocoToTableEntityConverter<PocoWithIndexerTimestamp>(),
72-
"If the Timestamp property is present, it must not be an indexer.");
73+
var exception = Assert.Throws<InvalidOperationException>(() => new PocoToTableEntityConverter<PocoWithIndexerTimestamp>());
74+
75+
Assert.AreEqual("If the Timestamp property is present, it must not be an indexer.", exception.Message);
7376
}
7477

7578
[Test]
7679
public void Create_IfETagIsNonString_Throws()
7780
{
7881
// Act & Assert
79-
ExceptionAssert.ThrowsInvalidOperation(() => new PocoToTableEntityConverter<PocoWithNonStringETag>(),
80-
"If the ETag property is present, it must be a String.");
82+
var exception = Assert.Throws<InvalidOperationException>(() => new PocoToTableEntityConverter<PocoWithNonStringETag>());
83+
84+
Assert.AreEqual("If the ETag property is present, it must be a String.", exception.Message);
8185
}
8286

8387
[Test]
8488
public void Create_IfETagHasIndexParameters_Throws()
8589
{
8690
// Act & Assert
87-
ExceptionAssert.ThrowsInvalidOperation(() => new PocoToTableEntityConverter<PocoWithIndexerETag>(),
88-
"If the ETag property is present, it must not be an indexer.");
91+
var exception = Assert.Throws<InvalidOperationException>(() => new PocoToTableEntityConverter<PocoWithIndexerETag>());
92+
93+
Assert.AreEqual("If the ETag property is present, it must not be an indexer.", exception.Message);
8994
}
9095

9196
[Test]

sdk/tables/Microsoft.Azure.WebJobs.Extensions.Tables/tests/TableEntityToPocoConverterTests.cs

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,68 +24,73 @@ public void Create_ReturnsInstance()
2424
[Test]
2525
public void Create_IfPartitionKeyIsNonString_Throws()
2626
{
27-
// Act & Assert
28-
ExceptionAssert.ThrowsInvalidOperation(
29-
() => new TableEntityToPocoConverter<PocoWithNonStringPartitionKey>(),
30-
"If the PartitionKey property is present, it must be a String.");
27+
// Act & Asset;
28+
var exception = Assert.Throws<InvalidOperationException>(() => new TableEntityToPocoConverter<PocoWithNonStringPartitionKey>());
29+
30+
Assert.AreEqual("If the PartitionKey property is present, it must be a String.", exception.Message);
3131
}
3232

3333
[Test]
3434
public void Create_IfPartitionKeyHasIndexParameters_Throws()
3535
{
3636
// Act & Assert
37-
ExceptionAssert.ThrowsInvalidOperation(
38-
() => new TableEntityToPocoConverter<PocoWithIndexerPartitionKey>(),
39-
"If the PartitionKey property is present, it must not be an indexer.");
37+
var exception = Assert.Throws<InvalidOperationException>(() => new TableEntityToPocoConverter<PocoWithIndexerPartitionKey>());
38+
39+
Assert.AreEqual("If the PartitionKey property is present, it must not be an indexer.", exception.Message);
4040
}
4141

4242
[Test]
4343
public void Create_IfRowKeyIsNonString_Throws()
4444
{
4545
// Act & Assert
46-
ExceptionAssert.ThrowsInvalidOperation(() => new TableEntityToPocoConverter<PocoWithNonStringRowKey>(),
47-
"If the RowKey property is present, it must be a String.");
46+
var exception = Assert.Throws<InvalidOperationException>(() => new TableEntityToPocoConverter<PocoWithNonStringRowKey>());
47+
48+
Assert.AreEqual("If the RowKey property is present, it must be a String.", exception.Message);
4849
}
4950

5051
[Test]
5152
public void Create_IfRowKeyHasIndexParameters_Throws()
5253
{
5354
// Act & Assert
54-
ExceptionAssert.ThrowsInvalidOperation(() => new TableEntityToPocoConverter<PocoWithIndexerRowKey>(),
55-
"If the RowKey property is present, it must not be an indexer.");
55+
var exception = Assert.Throws<InvalidOperationException>(() => new TableEntityToPocoConverter<PocoWithIndexerRowKey>());
56+
57+
Assert.AreEqual("If the RowKey property is present, it must not be an indexer.", exception.Message);
5658
}
5759

5860
[Test]
5961
public void Create_IfTimestampIsNonDateTimeOffset_Throws()
6062
{
6163
// Act & Assert
62-
ExceptionAssert.ThrowsInvalidOperation(
63-
() => new TableEntityToPocoConverter<PocoWithNonDateTimeOffsetTimestamp>(),
64-
"If the Timestamp property is present, it must be a DateTimeOffset.");
64+
var exception = Assert.Throws<InvalidOperationException>(() => new TableEntityToPocoConverter<PocoWithNonDateTimeOffsetTimestamp>());
65+
66+
Assert.AreEqual("If the Timestamp property is present, it must be a DateTimeOffset.", exception.Message);
6567
}
6668

6769
[Test]
6870
public void Create_IfTimestampHasIndexParameters_Throws()
6971
{
7072
// Act & Assert
71-
ExceptionAssert.ThrowsInvalidOperation(() => new TableEntityToPocoConverter<PocoWithIndexerTimestamp>(),
72-
"If the Timestamp property is present, it must not be an indexer.");
73+
var exception = Assert.Throws<InvalidOperationException>(() => new TableEntityToPocoConverter<PocoWithIndexerTimestamp>());
74+
75+
Assert.AreEqual("If the Timestamp property is present, it must not be an indexer.", exception.Message);
7376
}
7477

7578
[Test]
7679
public void Create_IfETagIsNonString_Throws()
7780
{
7881
// Act & Assert
79-
ExceptionAssert.ThrowsInvalidOperation(() => new TableEntityToPocoConverter<PocoWithNonStringETag>(),
80-
"If the ETag property is present, it must be a String.");
82+
var exception = Assert.Throws<InvalidOperationException>(() => new TableEntityToPocoConverter<PocoWithNonStringETag>());
83+
84+
Assert.AreEqual("If the ETag property is present, it must be a String.", exception.Message);
8185
}
8286

8387
[Test]
8488
public void Create_IfETagHasIndexParameters_Throws()
8589
{
8690
// Act & Assert
87-
ExceptionAssert.ThrowsInvalidOperation(() => new TableEntityToPocoConverter<PocoWithIndexerETag>(),
88-
"If the ETag property is present, it must not be an indexer.");
91+
var exception = Assert.Throws<InvalidOperationException>(() => new TableEntityToPocoConverter<PocoWithIndexerETag>());
92+
93+
Assert.AreEqual("If the ETag property is present, it must not be an indexer.", exception.Message);
8994
}
9095

9196
[Test]

sdk/tables/Microsoft.Azure.WebJobs.Extensions.Tables/tests/WebJobsShared/ExceptionAssert.cs

Lines changed: 0 additions & 47 deletions
This file was deleted.

sdk/tables/Microsoft.Azure.WebJobs.Extensions.Tables/tests/WebJobsShared/FakeTypeLocator.cs

Lines changed: 0 additions & 19 deletions
This file was deleted.

sdk/tables/Microsoft.Azure.WebJobs.Extensions.Tables/tests/WebJobsShared/LogMessage.cs

Lines changed: 0 additions & 31 deletions
This file was deleted.

sdk/tables/Microsoft.Azure.WebJobs.Extensions.Tables/tests/WebJobsShared/TestExceptionHandler.cs

Lines changed: 0 additions & 26 deletions
This file was deleted.

sdk/tables/Microsoft.Azure.WebJobs.Extensions.Tables/tests/WebJobsShared/TestExceptionHandlerFactory.cs

Lines changed: 0 additions & 14 deletions
This file was deleted.

sdk/tables/Microsoft.Azure.WebJobs.Extensions.Tables/tests/WebJobsShared/TestHelpers.cs

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)