Permalink
Browse files

re-factor tests

  • Loading branch information...
1 parent c60b348 commit 6c3bf709051a359d47864927e500a8a788f059a0 @mythz mythz committed Mar 21, 2012
Showing with 112 additions and 1,708 deletions.
  1. +1 −1 NuGet/ServiceStack.Common/servicestack.common.nuspec
  2. +1 −1 NuGet/ServiceStack/servicestack.nuspec
  3. BIN lib/ServiceStack.OrmLite.SqlServer.dll
  4. BIN lib/ServiceStack.OrmLite.Sqlite.dll
  5. BIN lib/ServiceStack.OrmLite.dll
  6. BIN lib/ServiceStack.OrmLite.pdb
  7. +7 −0 lib/ServiceStack.Text.XML
  8. BIN lib/ServiceStack.Text.dll
  9. BIN lib/tests/ServiceStack.Common.dll
  10. BIN lib/tests/ServiceStack.Interfaces.dll
  11. BIN lib/tests/ServiceStack.OrmLite.SqlServer.dll
  12. BIN lib/tests/ServiceStack.OrmLite.Sqlite.dll
  13. BIN lib/tests/ServiceStack.OrmLite.Sqlite.pdb
  14. BIN lib/tests/ServiceStack.OrmLite.dll
  15. BIN lib/tests/ServiceStack.OrmLite.pdb
  16. +0 −1,299 lib/tests/ServiceStack.Redis.XML
  17. BIN lib/tests/ServiceStack.Redis.dll
  18. BIN lib/tests/ServiceStack.Redis.pdb
  19. BIN lib/tests/ServiceStack.Text.dll
  20. +0 −386 lib/tests/ServiceStack.Text.xml
  21. +1 −1 src/ServiceStack.Common/Properties/AssemblyInfo.cs
  22. +0 −1 src/ServiceStack.ServiceInterface/ServiceModel/ResponseStatusTranslator.cs
  23. +11 −0 src/ServiceStack.ServiceInterface/ServiceUtils.cs
  24. +1 −1 src/ServiceStack/Properties/AssemblyInfo.cs
  25. +4 −0 tests/ServiceStack.Common.Tests/OAuth/OAuthUserSessionTestsBase.cs
  26. +8 −4 tests/ServiceStack.Common.Tests/OAuth/OAuthUserSessionWithoutTestSourceTests.cs
  27. +55 −0 tests/ServiceStack.Common.Tests/OAuth/OrmLiteUserAuthTests.cs
  28. +23 −14 tests/ServiceStack.Common.Tests/ServiceStack.Common.Tests.csproj
  29. BIN tests/ServiceStack.Common.Tests/sqlite3.dll
@@ -2,7 +2,7 @@
<package xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<id>ServiceStack.Common</id>
- <version>3.6.2</version>
+ <version>3.6.3</version>
<authors>Demis Bellot</authors>
<owners>Demis Bellot</owners>
<summary>Opensource .NET and Mono REST Web Services framework</summary>
@@ -2,7 +2,7 @@
<package xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<id>ServiceStack</id>
- <version>3.6.2</version>
+ <version>3.6.3</version>
<authors>Demis Bellot</authors>
<owners>Demis Bellot</owners>
<summary>Opensource .NET and Mono REST Web Services framework</summary>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -33,7 +33,7 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("3.6.2.*")]
+[assembly: AssemblyVersion("3.6.3.*")]
// CCB Custom
[assembly: ContractNamespace("http://schemas.servicestack.net/types",
@@ -41,7 +41,6 @@ public ResponseStatus Parse(Exception exception)
return this.Parse(validationException);
}
-
var httpError = exception as IHttpError;
return httpError != null
? CreateErrorResponse(httpError.ErrorCode, httpError.Message)
@@ -44,6 +44,17 @@ public static object CreateErrorResponse<TRequest>(TRequest request, Exception e
{
httpError.Response = responseDto;
}
+ //Do we need this?
+ //if (httpError.Response == null)
+ //{
+ // var httpEx = httpError as HttpError;
+ // if (httpEx != null && httpEx.InnerException != null)
+ // {
+ // responseStatus = responseStatus ?? ResponseStatusTranslator.Instance.Parse(httpEx.InnerException);
+ // httpEx.Response = CreateResponseDto(request, responseStatus);
+ // }
+ //}
+
return httpError;
}
@@ -33,4 +33,4 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("3.6.2.*")]
+[assembly: AssemblyVersion("3.6.3.*")]
@@ -21,6 +21,8 @@ namespace ServiceStack.Common.Tests.OAuth
{
public abstract class OAuthUserSessionTestsBase
{
+ public static bool LoadUserAuthRepositorys = true;
+
//Can only use either 1 OrmLiteDialectProvider at 1-time SqlServer or Sqlite.
public static bool UseSqlServer = false;
@@ -55,6 +57,8 @@ public IEnumerable UserAuthRepositorys
{
get
{
+ if (!LoadUserAuthRepositorys) yield break;
+
var inMemoryRepo = new InMemoryAuthRepository();
inMemoryRepo.Clear();
yield return new TestCaseData(inMemoryRepo);
@@ -1,13 +1,15 @@
using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
+using System.IO;
using NUnit.Framework;
using ServiceStack.Common.Utils;
using ServiceStack.OrmLite;
using ServiceStack.OrmLite.SqlServer;
using ServiceStack.OrmLite.Sqlite;
using ServiceStack.Redis;
-using ServiceStack.ServiceInterface.Auth;
-
+using ServiceStack.ServiceInterface.Auth;
+using ServiceStack.Text;
+
namespace ServiceStack.Common.Tests.OAuth
{
//[TestFixture, Ignore("Manual OAuth Test with iteration over data stores")]
@@ -86,6 +88,8 @@ public void Does_merge_FacebookOAuth_TwitterOAuth()
public void Can_login_with_user_created_CreateUserAuth()
{
userAuthRepositorys.ForEach(x => tests.Can_login_with_user_created_CreateUserAuth(x));
- }
+ }
+
+
}
}
@@ -0,0 +1,55 @@
+using System;
+using System.IO;
+using NUnit.Framework;
+using ServiceStack.Common.Utils;
+using ServiceStack.OrmLite;
+using ServiceStack.OrmLite.Sqlite;
+using ServiceStack.ServiceInterface.Auth;
+using ServiceStack.Text;
+
+namespace ServiceStack.Common.Tests.OAuth
+{
+ [TestFixture]
+ public class OrmLiteUserAuthTests
+ {
+ [Test]
+ public void Can_insert_table_with_UserAuth()
+ {
+ OrmLiteConfig.DialectProvider = SqliteOrmLiteDialectProvider.Instance;
+ var connectionString = "~/App_Data/db.sqlite".MapAbsolutePath();
+ if (File.Exists(connectionString))
+ File.Delete(connectionString);
+
+ using (var db = connectionString.OpenDbConnection())
+ using (var dbCmd = db.CreateCommand())
+ {
+ dbCmd.CreateTable<UserAuth>(true);
+
+ //var userAuth = new UserAuth {
+ // Id = 1,
+ // UserName = "UserName",
+ // Email = "a@b.com",
+ // PrimaryEmail = "c@d.com",
+ // FirstName = "FirstName",
+ // LastName = "LastName",
+ // DisplayName = "DisplayName",
+ // Salt = "Salt",
+ // PasswordHash = "PasswordHash",
+ // CreatedDate = DateTime.Now,
+ // ModifiedDate = DateTime.UtcNow,
+ //};
+
+ var jsv = "{Id:0,UserName:UserName,Email:as@if.com,PrimaryEmail:as@if.com,FirstName:FirstName,LastName:LastName,DisplayName:DisplayName,Salt:WMQi/g==,PasswordHash:oGdE40yKOprIgbXQzEMSYZe3vRCRlKGuqX2i045vx50=,Roles:[],Permissions:[],CreatedDate:2012-03-20T07:53:48.8720739Z,ModifiedDate:2012-03-20T07:53:48.8720739Z}";
+ var userAuth = jsv.To<UserAuth>();
+
+ dbCmd.Insert(userAuth);
+
+ var rows = dbCmd.Select<UserAuth>(q => q.UserName == "UserName");
+
+ Console.WriteLine(rows[0].Dump());
+
+ Assert.That(rows[0].UserName, Is.EqualTo(userAuth.UserName));
+ }
+ }
+ }
+}
@@ -77,14 +77,27 @@
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
+ <Reference Include="Mono.Data.Sqlite, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\tests\Mono.Data.Sqlite.dll</HintPath>
+ </Reference>
<Reference Include="Moq">
<HintPath>..\..\lib\tests\Moq.dll</HintPath>
</Reference>
- <Reference Include="ServiceStack.OrmLite.SqlServer">
- <HintPath>..\..\lib\tests\ServiceStack.OrmLite.SqlServer.dll</HintPath>
+ <Reference Include="ServiceStack.OrmLite, Version=3.6.3.4006, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\ServiceStack.OrmLite.dll</HintPath>
+ </Reference>
+ <Reference Include="ServiceStack.OrmLite.Sqlite, Version=1.0.0.0, Culture=neutral, processorArchitecture=x86">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\ServiceStack.OrmLite.Sqlite.dll</HintPath>
+ </Reference>
+ <Reference Include="ServiceStack.OrmLite.SqlServer, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\ServiceStack.OrmLite.SqlServer.dll</HintPath>
</Reference>
<Reference Include="ServiceStack.Redis">
- <HintPath>..\..\lib\tests\ServiceStack.Redis.dll</HintPath>
+ <HintPath>..\..\lib\ServiceStack.Redis.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations">
@@ -108,12 +121,6 @@
<Reference Include="nunit.framework">
<HintPath>..\..\lib\tests\nunit.framework.dll</HintPath>
</Reference>
- <Reference Include="ServiceStack.OrmLite">
- <HintPath>..\..\lib\tests\ServiceStack.OrmLite.dll</HintPath>
- </Reference>
- <Reference Include="ServiceStack.OrmLite.Sqlite">
- <HintPath>..\..\lib\tests\ServiceStack.OrmLite.Sqlite.dll</HintPath>
- </Reference>
<Reference Include="ServiceStack.Text">
<HintPath>..\..\lib\ServiceStack.Text.dll</HintPath>
</Reference>
@@ -143,6 +150,7 @@
<Compile Include="Models\ShipperFactory.cs" />
<Compile Include="Models\BuiltInsFactory.cs" />
<Compile Include="OAuth\OAuthUserSessionTests.cs" />
+ <Compile Include="OAuth\OrmLiteUserAuthTests.cs" />
<Compile Include="OAuth\RegistrationServiceTests.cs" />
<Compile Include="OAuth\CredentialsServiceTests.cs" />
<Compile Include="OAuth\MockAuthHttpGateway.cs" />
@@ -204,11 +212,6 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
- <Content Include="sqlite3.dll">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </Content>
- </ItemGroup>
- <ItemGroup>
<Folder Include="App_Data\" />
<Folder Include="Models\DdnContentIngest\" />
</ItemGroup>
@@ -246,6 +249,12 @@
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
+ <ItemGroup>
+ <Content Include="..\..\lib\tests\sqlite3.dll">
+ <Link>sqlite3.dll</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Binary file not shown.

0 comments on commit 6c3bf70

Please sign in to comment.