public void ResolveTableNameIsThreadSafe() { const int iterationCount = 100; for (int i = 0; i < iterationCount; i++) { MobileServiceContractResolver contractResolver = new MobileServiceContractResolver(); Action resolveTableName = () => contractResolver.ResolveTableName(typeof(PocoType)); Task t1 = Task.Run(resolveTableName); Task t2 = Task.Run(resolveTableName); Task.WhenAll(t1, t2).Wait(); } }
public void ResolveTableName() { MobileServiceContractResolver contractResolver = new MobileServiceContractResolver(); List<Tuple<Type, string>> testCases = new List<Tuple<Type, string>>() { new Tuple<Type, string>(typeof(PocoType), "PocoType"), new Tuple<Type, string>(typeof(DataContractType), "DataContractNameFromAttributeType"), new Tuple<Type, string>(typeof(DataTableType), "NamedDataTableType"), new Tuple<Type, string>(typeof(JsonContainerType), "NamedJsonContainerType"), new Tuple<Type, string>(typeof(UnnamedJsonContainerType), "UnnamedJsonContainerType"), }; foreach (var testCase in testCases) { var input = testCase.Item1; string expected = testCase.Item2; var actual = contractResolver.ResolveTableName(input); Assert.AreEqual(actual, expected); } }
public void ResolveTableName() { MobileServiceContractResolver contractResolver = new MobileServiceContractResolver(); List <Tuple <Type, string> > testCases = new List <Tuple <Type, string> >() { new Tuple <Type, string>(typeof(PocoType), "PocoType"), new Tuple <Type, string>(typeof(DataContractType), "DataContractNameFromAttributeType"), new Tuple <Type, string>(typeof(DataTableType), "NamedDataTableType"), new Tuple <Type, string>(typeof(JsonContainerType), "NamedJsonContainerType"), new Tuple <Type, string>(typeof(UnnamedJsonContainerType), "UnnamedJsonContainerType"), }; foreach (var testCase in testCases) { var input = testCase.Item1; string expected = testCase.Item2; var actual = contractResolver.ResolveTableName(input); Assert.AreEqual(actual, expected); } }