diff --git a/test/E2ETest/Microsoft.Test.E2E.AspNet.OData/Formatter/CollectionPropertyTests.cs b/test/E2ETest/Microsoft.Test.E2E.AspNet.OData/Formatter/CollectionPropertyTests.cs index a2c77ae718..9f1e2d529e 100644 --- a/test/E2ETest/Microsoft.Test.E2E.AspNet.OData/Formatter/CollectionPropertyTests.cs +++ b/test/E2ETest/Microsoft.Test.E2E.AspNet.OData/Formatter/CollectionPropertyTests.cs @@ -8,6 +8,7 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Diagnostics; using System.Linq; using System.Threading.Tasks; using Microsoft.OData.Client; @@ -69,7 +70,10 @@ public async Task SupportPostCollectionPropertyByEntityPayload() // clear respository await this.ClearRepositoryAsync("CollectionProperty_Entity"); - var rand = new Random(RandomSeedGenerator.GetRandomSeed()); + var seed = RandomSeedGenerator.GetRandomSeed(); + Trace.WriteLine($"Generated seed for random number generator: {seed}"); + + var rand = new Random(seed); // post new entity to repository var baseline = InstanceCreator.CreateInstanceOf(rand, settings); diff --git a/test/E2ETest/Microsoft.Test.E2E.AspNet.OData/Formatter/ComplexTypeTests.cs b/test/E2ETest/Microsoft.Test.E2E.AspNet.OData/Formatter/ComplexTypeTests.cs index 32335bb5b1..85a6eff3de 100644 --- a/test/E2ETest/Microsoft.Test.E2E.AspNet.OData/Formatter/ComplexTypeTests.cs +++ b/test/E2ETest/Microsoft.Test.E2E.AspNet.OData/Formatter/ComplexTypeTests.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Threading.Tasks; using Microsoft.OData.Client; @@ -66,7 +67,10 @@ public async Task ShouldSupportDerivedComplexTypeAsync() // clear respository await this.ClearRepositoryAsync("ComplexTypeTests_Entity"); - var rand = new Random(RandomSeedGenerator.GetRandomSeed()); + var seed = RandomSeedGenerator.GetRandomSeed(); + Trace.WriteLine($"Generated seed for random number generator: {seed}"); + + var rand = new Random(seed); // post new entity to repository var baseline = InstanceCreator.CreateInstanceOf(rand, settings); diff --git a/test/E2ETest/Microsoft.Test.E2E.AspNet.OData/Formatter/DeltaTests.cs b/test/E2ETest/Microsoft.Test.E2E.AspNet.OData/Formatter/DeltaTests.cs index 26ad72d42f..56a93a366b 100644 --- a/test/E2ETest/Microsoft.Test.E2E.AspNet.OData/Formatter/DeltaTests.cs +++ b/test/E2ETest/Microsoft.Test.E2E.AspNet.OData/Formatter/DeltaTests.cs @@ -33,6 +33,7 @@ #else using System; using System.Collections.Generic; +using System.Diagnostics; using System.ComponentModel; using System.Dynamic; using System.Linq; @@ -222,7 +223,10 @@ public async Task TestApplyPatchOnIndividualProperty() await this.Client.GetStringAsync(this.BaseAddress + "/$metadata"); - Random r = new Random(RandomSeedGenerator.GetRandomSeed()); + var seed = RandomSeedGenerator.GetRandomSeed(); + Trace.WriteLine($"Generated seed for random number generator: {seed}"); + + var r = new Random(seed); var s = new CreatorSettings() { diff --git a/test/E2ETest/Microsoft.Test.E2E.AspNet.OData/Formatter/InheritanceTests.cs b/test/E2ETest/Microsoft.Test.E2E.AspNet.OData/Formatter/InheritanceTests.cs index 9123c1dab2..b03d0752ed 100644 --- a/test/E2ETest/Microsoft.Test.E2E.AspNet.OData/Formatter/InheritanceTests.cs +++ b/test/E2ETest/Microsoft.Test.E2E.AspNet.OData/Formatter/InheritanceTests.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Net; using System.Threading.Tasks; @@ -271,7 +272,10 @@ public async Task PostGetUpdateAndDelete(Type entityType, string entitySetNam) .FirstOrDefault(); var concreteTestMethod = testMethod.MakeGenericMethod(entityType); - var rand = new Random(RandomSeedGenerator.GetRandomSeed()); + var seed = RandomSeedGenerator.GetRandomSeed(); + Trace.WriteLine($"Generated seed for random number generator: {seed}"); + + var rand = new Random(seed); await (Task)concreteTestMethod.Invoke(this, new object[] { entitySetNam, rand }); } @@ -387,7 +391,10 @@ public virtual async Task AddAndRemoveBaseNavigationPropertyInDerivedType() // clear respository await this.ClearRepositoryAsync("InheritanceTests_Cars"); - Random r = new Random(RandomSeedGenerator.GetRandomSeed()); + var seed = RandomSeedGenerator.GetRandomSeed(); + Trace.WriteLine($"Generated seed for random number generator: {seed}"); + + var r = new Random(seed); // post new entity to repository CreatorSettings creatorSettings = new CreatorSettings() @@ -429,7 +436,10 @@ public virtual async Task AddAndRemoveDerivedNavigationPropertyInDerivedType() // clear respository await this.ClearRepositoryAsync("InheritanceTests_Cars"); - Random r = new Random(RandomSeedGenerator.GetRandomSeed()); + var seed = RandomSeedGenerator.GetRandomSeed(); + Trace.WriteLine($"Generated seed for random number generator: {seed}"); + + var r = new Random(seed); // post new entity to repository CreatorSettings creatorSettings = new CreatorSettings() @@ -471,7 +481,10 @@ public virtual async Task CreateAndDeleteLinkToDerivedNavigationPropertyOnBaseEn // clear respository await this.ClearRepositoryAsync("InheritanceTests_Vehicles"); - Random r = new Random(RandomSeedGenerator.GetRandomSeed()); + var seed = RandomSeedGenerator.GetRandomSeed(); + Trace.WriteLine($"Generated seed for random number generator: {seed}"); + + var r = new Random(seed); // post new entity to repository CreatorSettings creatorSettings = new CreatorSettings() diff --git a/test/E2ETest/Microsoft.Test.E2E.AspNet.OData/Formatter/JsonLight/Metadata/MetadataTestHelpers.cs b/test/E2ETest/Microsoft.Test.E2E.AspNet.OData/Formatter/JsonLight/Metadata/MetadataTestHelpers.cs index 266c6aff99..2c53c7198f 100644 --- a/test/E2ETest/Microsoft.Test.E2E.AspNet.OData/Formatter/JsonLight/Metadata/MetadataTestHelpers.cs +++ b/test/E2ETest/Microsoft.Test.E2E.AspNet.OData/Formatter/JsonLight/Metadata/MetadataTestHelpers.cs @@ -6,6 +6,7 @@ //------------------------------------------------------------------------------ using System; +using System.Diagnostics; using System.Net.Http; using System.Net.Http.Headers; using Microsoft.Test.E2E.AspNet.OData.Common.Instancing; @@ -22,7 +23,12 @@ public static void SetAcceptHeader(this HttpRequestMessage message, string accep public static T CreateInstances() { - var results = InstanceCreator.CreateInstanceOf(new Random(RandomSeedGenerator.GetRandomSeed()), new CreatorSettings { NullValueProbability = 0, AllowEmptyCollection = false }); + var seed = RandomSeedGenerator.GetRandomSeed(); + Trace.WriteLine($"Generated seed for random number generator: {seed}"); + + var random = new Random(seed); + + var results = InstanceCreator.CreateInstanceOf(random, new CreatorSettings { NullValueProbability = 0, AllowEmptyCollection = false }); return results; } diff --git a/test/E2ETest/Microsoft.Test.E2E.AspNet.OData/Formatter/RandomModelTests.cs b/test/E2ETest/Microsoft.Test.E2E.AspNet.OData/Formatter/RandomModelTests.cs index 93979bfa4c..801d31fbd3 100644 --- a/test/E2ETest/Microsoft.Test.E2E.AspNet.OData/Formatter/RandomModelTests.cs +++ b/test/E2ETest/Microsoft.Test.E2E.AspNet.OData/Formatter/RandomModelTests.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Reflection; using System.Threading.Tasks; @@ -36,7 +37,11 @@ public static ODataModelTypeCreator Creator if (creator == null) { creator = new ODataModelTypeCreator(); - creator.CreateTypes(50, new Random(RandomSeedGenerator.GetRandomSeed())); + var seed = RandomSeedGenerator.GetRandomSeed(); + Trace.WriteLine($"Generated seed for random number generator: {seed}"); + + var random = new Random(seed); + creator.CreateTypes(50, random); } return creator; } @@ -77,7 +82,10 @@ public async Task TestRandomEntityTypesAsync(string entitySetName) await this.ClearRepositoryAsync(entitySetName); // TODO: Get ride of random generator in test codes. It's bad idea to introduce random factors in functional test - var rand = new Random(RandomSeedGenerator.GetRandomSeed()); + var seed = RandomSeedGenerator.GetRandomSeed(); + Trace.WriteLine($"Generated seed for random number generator: {seed}"); + + var rand = new Random(seed); T entityBaseline = await PostNewEntityAsync(entitySetName, rand); diff --git a/test/E2ETest/Microsoft.Test.E2E.AspNet.OData/ODataPathHandler/UnicodeRouteTests.cs b/test/E2ETest/Microsoft.Test.E2E.AspNet.OData/ODataPathHandler/UnicodeRouteTests.cs index e10f5a9d66..01b6264084 100644 --- a/test/E2ETest/Microsoft.Test.E2E.AspNet.OData/ODataPathHandler/UnicodeRouteTests.cs +++ b/test/E2ETest/Microsoft.Test.E2E.AspNet.OData/ODataPathHandler/UnicodeRouteTests.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Threading.Tasks; using Microsoft.OData.Client; @@ -72,7 +73,10 @@ protected static IEdmModel GetEdmModel(WebRouteConfiguration configuration) [Fact] public async Task CRUDEntitySetShouldWork() { - var rand = new Random(RandomSeedGenerator.GetRandomSeed()); + var seed = RandomSeedGenerator.GetRandomSeed(); + Trace.WriteLine($"Generated seed for random number generator: {seed}"); + + var rand = new Random(seed); var entitySetName = "UnicodeRouteTests_TodoĆ¼"; var uri = new Uri(this.BaseAddress + "/odataĆ¼"); var context = new DataServiceContext(uri, ODataProtocolVersion.V4); diff --git a/test/E2ETest/Microsoft.Test.E2E.AspNet.OData/QueryComposition/QueryFuzzingTests.cs b/test/E2ETest/Microsoft.Test.E2E.AspNet.OData/QueryComposition/QueryFuzzingTests.cs index fb11481bb1..c2ce0028fc 100644 --- a/test/E2ETest/Microsoft.Test.E2E.AspNet.OData/QueryComposition/QueryFuzzingTests.cs +++ b/test/E2ETest/Microsoft.Test.E2E.AspNet.OData/QueryComposition/QueryFuzzingTests.cs @@ -32,6 +32,8 @@ public static TheoryDataSet FuzzingQueries { var data = new TheoryDataSet(); int seed = RandomSeedGenerator.GetRandomSeed(); + Trace.WriteLine($"Generated seed for random number generator: {seed}"); + var ranGen = new Random(seed); for (int i = 5; i <= 10; i += 5) diff --git a/test/E2ETest/Microsoft.Test.E2E.AspNet.OData/QueryComposition/ServerTypeTests.cs b/test/E2ETest/Microsoft.Test.E2E.AspNet.OData/QueryComposition/ServerTypeTests.cs index dd032cbd9e..e67cc69b0e 100644 --- a/test/E2ETest/Microsoft.Test.E2E.AspNet.OData/QueryComposition/ServerTypeTests.cs +++ b/test/E2ETest/Microsoft.Test.E2E.AspNet.OData/QueryComposition/ServerTypeTests.cs @@ -54,7 +54,11 @@ public static ODataModelTypeCreator Creator if (creator == null) { creator = new ODataModelTypeCreator(); - creator.CreateTypes(100, new Random(RandomSeedGenerator.GetRandomSeed())); + var seed = RandomSeedGenerator.GetRandomSeed(); + Trace.WriteLine($"Generated seed for random number generator: {seed}"); + + var random = new Random(seed); + creator.CreateTypes(100, random); } return creator; } @@ -221,6 +225,8 @@ private static string BuildFilterString(Type type) public void RunQueryableOnAllPossibleTypes(Type type, string queryString) { int seed = RandomSeedGenerator.GetRandomSeed(); + Trace.WriteLine($"Generated seed for random number generator: {seed}"); + Random r = new Random(seed); Type generic = typeof(IEnumerable<>); var collectionType = generic.MakeGenericType(type);